create-lwr 0.9.0-alpha.9 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,12 +3,14 @@
3
3
  ## Scaffolding Your First LWR Project
4
4
 
5
5
  > **Compatibility Note:**
6
- > LWR requires [Node.js](https://nodejs.org/en/) version >=14.0.0.
6
+ > LWR requires [Node.js](https://nodejs.org/en/) version >=16.0.0 <20.
7
+
8
+ > **Note:** If you've previously installed `create-lwr` globally, we recommend you uninstall the package using `npm uninstall -g create-lwr` or `yarn global remove create-lwr` to ensure the latest version is always used.
7
9
 
8
10
  With NPM:
9
11
 
10
12
  ```bash
11
- $ npm init lwr
13
+ $ npm init lwr@latest
12
14
  ```
13
15
 
14
16
  With Yarn:
@@ -30,7 +32,4 @@ npm init lwr@latest my-lwr-app -- --template lwc-ts
30
32
 
31
33
  # yarn
32
34
  yarn create lwr my-lwr-app --template lwc-ts
33
-
34
- # pnpm
35
- pnpx create-lwr my-lwr-app --template lwc-ts
36
35
  ```
package/build/es/index.js CHANGED
@@ -5,13 +5,18 @@ import minimist from 'minimist';
5
5
  import { emptyDir, copy, pkgFromUserAgent, promptForAnswers, updateLwrVersion } from './utils.js';
6
6
  import { dirname } from 'path';
7
7
  import { fileURLToPath } from 'url';
8
+ import { dim } from 'kolorist';
8
9
  const __dirname = dirname(fileURLToPath(import.meta.url));
9
10
  const cwd = process.cwd();
11
+ const rooDir = path.join(__dirname, '../../');
12
+ const rootPkg = JSON.parse(fs.readFileSync(path.join(rooDir, `package.json`), 'utf-8'));
13
+ const LWR_VERSION = rootPkg.version;
10
14
  const argv = minimist(process.argv.slice(2), { string: ['_'] });
11
15
  const renameFiles = {
12
16
  _gitignore: '.gitignore',
13
17
  };
14
18
  export async function init() {
19
+ console.log(dim(`create-lwr v${LWR_VERSION}`));
15
20
  const targetDir = argv._[0];
16
21
  const metadata = {
17
22
  targetDir,
@@ -72,6 +77,11 @@ function writePackageFile(projectRoot, templateDir, packageName, metadata) {
72
77
  write(projectRoot, templateDir, 'package.json', JSON.stringify(pkg, null, 2));
73
78
  const pkgInfo = pkgFromUserAgent(process.env.npm_config_user_agent);
74
79
  const pkgManager = pkgInfo ? pkgInfo.name : 'npm';
80
+ if (pkgManager === 'yarn') {
81
+ // Set nodeLinker in .yarnrc.yml if yarn is the selected package manager.
82
+ // LWR does not work when included in yarn pnp.
83
+ write(projectRoot, templateDir, '.yarnrc.yml', 'nodeLinker: node-modules');
84
+ }
75
85
  return pkgManager;
76
86
  }
77
87
  function logResult(projectRoot, pkgManager) {
package/package.json CHANGED
@@ -3,16 +3,17 @@
3
3
  "homepage": "https://developer.salesforce.com/docs/platform/lwr/overview",
4
4
  "repository": {
5
5
  "type": "git",
6
- "url": "https://github.com/salesforce/lwr.git",
6
+ "url": "https://github.com/salesforce-experience-platform-emu/lwr.git",
7
7
  "directory": "packages/create-lwr"
8
8
  },
9
9
  "bugs": {
10
- "url": "https://github.com/salesforce/lwr/issues"
10
+ "url": "https://github.com/salesforce-experience-platform-emu/lwr/issues"
11
11
  },
12
12
  "bin": {
13
13
  "create-lwr": "build/es/index.js"
14
14
  },
15
15
  "scripts": {
16
+ "build": "tsc -b",
16
17
  "local:bin": "node ./build/es/index.js"
17
18
  },
18
19
  "license": "MIT",
@@ -21,7 +22,7 @@
21
22
  },
22
23
  "type": "module",
23
24
  "types": "build/es/index.d.ts",
24
- "version": "0.9.0-alpha.9",
25
+ "version": "0.9.0",
25
26
  "module": "build/es/index.js",
26
27
  "main": "build/cjs/index.cjs",
27
28
  "files": [
@@ -35,9 +36,15 @@
35
36
  "require": "./build/cjs/index.cjs"
36
37
  },
37
38
  "dependencies": {
38
- "kolorist": "^1.5.0",
39
- "minimist": "^1.2.6",
40
- "prompts": "^2.4.1"
39
+ "kolorist": "^1.7.0",
40
+ "minimist": "^1.2.8",
41
+ "prompts": "^2.4.2"
41
42
  },
42
- "gitHead": "93522592d25375bb20da156f864d153ffcd3ec88"
43
+ "engines": {
44
+ "node": ">=16.0.0 <20"
45
+ },
46
+ "volta": {
47
+ "extends": "../../package.json"
48
+ },
49
+ "gitHead": "4e42b0dc5453f92b36b42aa8132c5bc281e616b7"
43
50
  }
@@ -7,11 +7,10 @@ The **LWC Boilerplate** example contains the minimum code needed to get a simple
7
7
  The directory structure looks like this:
8
8
 
9
9
  ```
10
- scripts/
11
- └── start-server.mjs // create and start server
12
10
  src/
13
11
  ├── assets/ // static assets
14
12
  │ └── recipes-logo.png
13
+ | └── favicon.ico
15
14
  └── modules/ // lwc modules
16
15
  └── example/
17
16
  └── app/
@@ -36,22 +35,36 @@ The LWR server is configured in `lwr.config.json`, at the root of the project. T
36
35
  "path": "/",
37
36
  "rootComponent": "example/app"
38
37
  }
38
+ ],
39
+ "assets": [
40
+ {
41
+ "alias": "assetsDir",
42
+ "dir": "$rootDir/src/assets",
43
+ "urlPath": "/public/assets"
44
+ },
45
+ {
46
+ "alias": "favicon",
47
+ "file": "$rootDir/src/assets/favicon.ico",
48
+ "urlPath": "/favicon.ico"
49
+ }
39
50
  ]
40
51
  }
41
52
  ```
42
53
 
43
- ## Running the Project
54
+ ## Running the Project in dev Mode
44
55
 
45
56
  ```bash
46
57
  yarn install
47
- yarn build
48
- yarn start # prod mode and ESM format
58
+ yarn dev # dev:compat for AMD format
49
59
  ```
50
60
 
51
61
  Open the site at [http://localhost:3000](http://localhost:3000)
52
62
 
53
- To start the project in a different mode:
63
+ ## Statically Generate and Preview the Site
54
64
 
55
- - dev: `yarn dev`
56
- - compat: `yarn start:compat`
57
- - prod-compat: `yarn start:prod-compat`
65
+ ```bash
66
+ yarn build # dev:prod-compat for AMD format
67
+ yarn start
68
+ ```
69
+
70
+ Open the site at [http://localhost:3000](http://localhost:3000)
@@ -6,5 +6,17 @@
6
6
  "path": "/",
7
7
  "rootComponent": "example/app"
8
8
  }
9
+ ],
10
+ "assets": [
11
+ {
12
+ "alias": "assetsDir",
13
+ "dir": "$rootDir/src/assets",
14
+ "urlPath": "/public/assets"
15
+ },
16
+ {
17
+ "alias": "favicon",
18
+ "file": "$rootDir/src/assets/favicon.ico",
19
+ "urlPath": "/favicon.ico"
20
+ }
9
21
  ]
10
22
  }
@@ -5,17 +5,23 @@
5
5
  "private": true,
6
6
  "type": "module",
7
7
  "scripts": {
8
- "clean": "rm -rf __lwr_cache__",
9
- "dev": "lwr serve",
10
- "start": "lwr serve --mode prod",
11
- "start:compat": "lwr serve --mode compat",
12
- "start:prod-compat": "lwr serve --mode prod-compat"
8
+ "clean": "rm -rf node_modules __lwr_cache__ site",
9
+ "dev": "lwr dev",
10
+ "dev:compat": "lwr dev --mode compat",
11
+ "build": "lwr build --clean",
12
+ "build:prod-compat": "lwr build --clean --mode prod-compat",
13
+ "start": "lwr start",
14
+ "stage": "yarn build && yarn start",
15
+ "stage:prod-compat": "yarn build:prod-compat && yarn start"
13
16
  },
14
17
  "dependencies": {
15
- "lwc": "2.33.0",
16
- "lwr": "0.8.0-alpha.5"
18
+ "lwc": "2.38.1",
19
+ "lwr": "latest"
17
20
  },
18
21
  "engines": {
19
- "node": ">=14.15.4 <19"
22
+ "node": ">=16.0.0 <20"
23
+ },
24
+ "volta": {
25
+ "node": "16.19.1"
20
26
  }
21
27
  }
@@ -7,11 +7,10 @@ The **LWC TS Boilerplate** example contains the minimum code needed to get a sim
7
7
  The directory structure looks like this:
8
8
 
9
9
  ```
10
- scripts/
11
- └── start-server.mjs // create and start server
12
10
  src/
13
11
  ├── assets/ // static assets
14
12
  │ └── recipes-logo.png
13
+ | └── favicon.ico
15
14
  └── modules/ // lwc modules
16
15
  └── example/
17
16
  └── app/
@@ -36,22 +35,36 @@ The LWR server is configured in `lwr.config.json`, at the root of the project. T
36
35
  "path": "/",
37
36
  "rootComponent": "example/app"
38
37
  }
38
+ ],
39
+ "assets": [
40
+ {
41
+ "alias": "assetsDir",
42
+ "dir": "$rootDir/src/assets",
43
+ "urlPath": "/public/assets"
44
+ },
45
+ {
46
+ "alias": "favicon",
47
+ "file": "$rootDir/src/assets/favicon.ico",
48
+ "urlPath": "/favicon.ico"
49
+ }
39
50
  ]
40
51
  }
41
52
  ```
42
53
 
43
- ## Running the Project
54
+ ## Running the Project in dev Mode
44
55
 
45
56
  ```bash
46
57
  yarn install
47
- yarn build
48
- yarn start # prod mode and ESM format
58
+ yarn dev # dev:compat for AMD format
49
59
  ```
50
60
 
51
61
  Open the site at [http://localhost:3000](http://localhost:3000)
52
62
 
53
- To start the project in a different mode:
63
+ ## Statically Generate and Preview the Site
54
64
 
55
- - dev: `yarn dev`
56
- - compat: `yarn start:compat`
57
- - prod-compat: `yarn start:prod-compat`
65
+ ```bash
66
+ yarn build # dev:prod-compat for AMD format
67
+ yarn start
68
+ ```
69
+
70
+ Open the site at [http://localhost:3000](http://localhost:3000)
@@ -6,5 +6,17 @@
6
6
  "path": "/",
7
7
  "rootComponent": "example/app"
8
8
  }
9
+ ],
10
+ "assets": [
11
+ {
12
+ "alias": "assetsDir",
13
+ "dir": "$rootDir/src/assets",
14
+ "urlPath": "/public/assets"
15
+ },
16
+ {
17
+ "alias": "favicon",
18
+ "file": "$rootDir/src/assets/favicon.ico",
19
+ "urlPath": "/favicon.ico"
20
+ }
9
21
  ]
10
22
  }
@@ -5,17 +5,23 @@
5
5
  "private": true,
6
6
  "type": "module",
7
7
  "scripts": {
8
- "clean": "rm -rf __lwr_cache__",
9
- "dev": "lwr serve",
10
- "start": "lwr serve --mode prod",
11
- "start:compat": "lwr serve --mode compat",
12
- "start:prod-compat": "lwr serve --mode prod-compat"
8
+ "clean": "rm -rf node_modules __lwr_cache__ site",
9
+ "dev": "lwr dev",
10
+ "dev:compat": "lwr dev --mode compat",
11
+ "build": "lwr build --clean",
12
+ "build:prod-compat": "lwr build --clean --mode prod-compat",
13
+ "start": "lwr start",
14
+ "stage": "yarn build && yarn start",
15
+ "stage:prod-compat": "yarn build:prod-compat && yarn start"
13
16
  },
14
17
  "dependencies": {
15
- "lwc": "2.33.0",
16
- "lwr": "0.8.0-alpha.5"
18
+ "lwc": "2.38.1",
19
+ "lwr": "latest"
17
20
  },
18
21
  "engines": {
19
- "node": ">=14.15.4 <19"
22
+ "node": ">=16.0.0 <20"
23
+ },
24
+ "volta": {
25
+ "node": "16.19.1"
20
26
  }
21
27
  }
@@ -0,0 +1 @@
1
+ nodeLinker: node-modules
@@ -7,10 +7,9 @@ The **Static Site** example contains the minimum code needed to get up and runni
7
7
  The directory structure looks like this:
8
8
 
9
9
  ```
10
- scripts/
11
- └── start-server.mjs // create and start server
12
10
  src/
13
11
  ├── assets/ // static assets
12
+ | └── favicon.ico
14
13
  │ └── css/
15
14
  │ └── main.css
16
15
  └── content/ // site pages
@@ -43,22 +42,36 @@ The LWR server is configured in `lwr.config.json`, at the root of the project. T
43
42
  "contentTemplate": "$contentDir/about.md",
44
43
  "layoutTemplate": "$layoutsDir/main_layout.njk"
45
44
  }
45
+ ],
46
+ "assets": [
47
+ {
48
+ "alias": "assetsDir",
49
+ "dir": "$rootDir/src/assets",
50
+ "urlPath": "/public/assets"
51
+ },
52
+ {
53
+ "alias": "favicon",
54
+ "file": "$rootDir/src/assets/favicon.ico",
55
+ "urlPath": "/favicon.ico"
56
+ }
46
57
  ]
47
58
  }
48
59
  ```
49
60
 
50
- ## Running the Project
61
+ ## Running the Project in dev Mode
51
62
 
52
63
  ```bash
53
64
  yarn install
54
- yarn build
55
- yarn start # prod mode and ESM format
65
+ yarn dev
56
66
  ```
57
67
 
58
68
  Open the site at [http://localhost:3000](http://localhost:3000)
59
69
 
60
- To start the project in a different mode:
70
+ ## Statically Generate and Preview the Site
61
71
 
62
- - dev: `yarn dev`
63
- - compat: `yarn start:compat`
64
- - prod-compat: `yarn start:prod-compat`
72
+ ```bash
73
+ yarn build
74
+ yarn start
75
+ ```
76
+
77
+ Open the site at [http://localhost:3000](http://localhost:3000)
@@ -13,5 +13,17 @@
13
13
  "contentTemplate": "$contentDir/about.md",
14
14
  "layoutTemplate": "$layoutsDir/main_layout.njk"
15
15
  }
16
+ ],
17
+ "assets": [
18
+ {
19
+ "alias": "assetsDir",
20
+ "dir": "$rootDir/src/assets",
21
+ "urlPath": "/public/assets"
22
+ },
23
+ {
24
+ "alias": "favicon",
25
+ "file": "$rootDir/src/assets/favicon.ico",
26
+ "urlPath": "/favicon.ico"
27
+ }
16
28
  ]
17
29
  }
@@ -5,17 +5,19 @@
5
5
  "private": true,
6
6
  "type": "module",
7
7
  "scripts": {
8
- "clean": "rm -rf __lwr_cache__",
9
- "dev": "lwr serve",
10
- "start": "lwr serve --mode prod",
11
- "start:compat": "lwr serve --mode compat",
12
- "start:prod-compat": "lwr serve --mode prod-compat"
8
+ "clean": "rm -rf node_modules __lwr_cache__ site",
9
+ "dev": "lwr dev",
10
+ "build": "lwr build --clean",
11
+ "start": "lwr start",
12
+ "stage": "yarn build && yarn start"
13
13
  },
14
14
  "dependencies": {
15
- "lwc": "2.33.0",
16
- "lwr": "0.8.0-alpha.5"
15
+ "lwr": "latest"
17
16
  },
18
17
  "engines": {
19
- "node": ">=14.15.4 <19"
18
+ "node": ">=16.0.0 <20"
19
+ },
20
+ "volta": {
21
+ "node": "16.19.1"
20
22
  }
21
23
  }