@master/create-css 2.0.0-rc.16 → 2.0.0-rc.19

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
@@ -41,7 +41,7 @@
41
41
  <img alt="Follow @mastercorg" src="https://img.shields.io/static/v1?label=%20&message=twitter&color=f6f7f8&logo=twitter&style=for-the-badge">
42
42
  </picture>
43
43
  </a>
44
- <a aria-label="Github Actions" href="https://github.com/1aron/repo/actions/workflows/release.yml">
44
+ <a aria-label="Github Actions" href="https://github.com/master-co/css/actions/workflows/release.yml">
45
45
  <picture>
46
46
  <source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/github/actions/workflow/status/master-co/css/release.yml?branch=rc&label=%20&message=twitter&color=212022&logo=githubactions&style=for-the-badge">
47
47
  <source media="(prefers-color-scheme: light)" srcset="https://img.shields.io/github/actions/workflow/status/master-co/css/release.yml?branch=rc&label=%20&message=twitter&color=f6f7f8&logo=githubactions&style=for-the-badge&logoColor=%23000">
@@ -11,6 +11,7 @@ import { writeFileSync, existsSync as existsSync$1 } from 'node:fs';
11
11
  import ora from 'ora';
12
12
  import { dirname } from 'path';
13
13
  import { fileURLToPath } from 'url';
14
+ import { exit } from 'node:process';
14
15
 
15
16
  var detectAppExt = (()=>{
16
17
  // automatically detect the format
@@ -120,23 +121,21 @@ module.exports = {
120
121
  functions: {}
121
122
  }`;
122
123
 
124
+ const BRANCH = 'rc';
125
+ const CURRENT_VERSION = '>=2.0.0-rc.1';
123
126
  const __filename = fileURLToPath(import.meta.url);
124
127
  const __dirname = dirname(__filename);
125
128
  const pkg = readJSONFileSync(resolve(__dirname, '../../package.json'));
126
129
  const program = new Command();
127
130
  program.name(pkg.name).description(pkg.description).version(pkg.version || 'workspace:^').argument('[project name]', 'The project name is used to create the folder').option('-o, --override', 'Override existing definition file').option('--ext <ext>', 'Specify the extension mjs, ts, js').option('--pm <package manager>', 'Specify the package manager npm, yarn, pnpm, bun').option('--example <folder name>', 'Specify the example folder name', 'blank').action(async function(appName, options) {
128
131
  if (!options.pm) {
129
- // Detect the package manager
130
- options.pm = await detect({
131
- cwd: process.cwd()
132
- });
132
+ options.pm = await detect();
133
133
  }
134
- const appPkg = readJSONFileSync('package.json');
135
134
  // Create a new app with the example
136
135
  if (appName) {
137
136
  log.i(`Detected **${options.pm}**`);
138
137
  const spinner = ora(`Initializing Master CSS`).start();
139
- const examplePath = `github:master-co/css/examples/${options.example}#rc`;
138
+ const examplePath = `github:master-co/css/examples/${options.example}#${BRANCH}`;
140
139
  spinner.start(`Cloning example from "${examplePath}"`);
141
140
  try {
142
141
  await downloadTemplate(examplePath, {
@@ -147,22 +146,24 @@ program.name(pkg.name).description(pkg.description).version(pkg.version || 'work
147
146
  return;
148
147
  }
149
148
  process.chdir(appName);
149
+ const appPkg = readJSONFileSync('package.json');
150
150
  if (!appPkg) {
151
- spinner.fail(`Cannot found "${examplePath}"`);
152
- log.i`View all available examples at **https://github.com/master-co/css/tree/rc/examples**`;
153
- return;
151
+ spinner.stop();
152
+ log.i`View all examples at **https://github.com/master-co/css/tree/${BRANCH}/examples**`;
153
+ log.x(`Cannot found "${examplePath}"`);
154
+ exit(1);
154
155
  }
155
156
  appPkg.name = appName;
156
157
  const targetPackages = [];
157
158
  for(const key in appPkg.dependencies){
158
- if (pkg.version && appPkg.dependencies[key] === 'workspace:^') {
159
- appPkg.dependencies[key] = `^${pkg.version}`;
159
+ if (appPkg.dependencies[key] === 'workspace:^') {
160
+ appPkg.dependencies[key] = CURRENT_VERSION;
160
161
  }
161
162
  targetPackages.push(key);
162
163
  }
163
164
  for(const key in appPkg.devDependencies){
164
- if (pkg.version && appPkg.devDependencies[key] === 'workspace:^') {
165
- appPkg.devDependencies[key] = `^${pkg.version}`;
165
+ if (appPkg.devDependencies[key] === 'workspace:^') {
166
+ appPkg.devDependencies[key] = CURRENT_VERSION;
166
167
  }
167
168
  targetPackages.push(key);
168
169
  }
@@ -179,14 +180,17 @@ program.name(pkg.name).description(pkg.description).version(pkg.version || 'work
179
180
  });
180
181
  log``;
181
182
  log.ok`Created **${appName}**`;
182
- log.i`Commands in this app:`;
183
- console.table(appPkg.scripts);
183
+ if (appPkg.scripts) {
184
+ log.i`Commands in this app:`;
185
+ console.table(appPkg.scripts);
186
+ }
184
187
  log.i`Start by running "cd ${appName} && ${options.pm} run ${appPkg.scripts?.dev ? 'dev' : 'start'}"`;
185
188
  } catch (error) {
186
189
  spinner.fail();
187
190
  throw error;
188
191
  }
189
192
  } else {
193
+ const appPkg = readJSONFileSync('package.json');
190
194
  options.ext = options.ext || detectAppExt();
191
195
  const create = (fileName, text)=>{
192
196
  const configExists = existsSync$1(fileName);
@@ -214,7 +218,7 @@ program.name(pkg.name).description(pkg.description).version(pkg.version || 'work
214
218
  }
215
219
  if (!appPkg?.dependencies?.['@master/css']) {
216
220
  log.i(`Detected **${options.pm}**`);
217
- log.i`Start "${options.pm} add @master/css@rc"`;
221
+ log.i`Start "${options.pm} add @master/css@${BRANCH}"`;
218
222
  log``;
219
223
  execSync(`${options.pm} add @master/css@rc`, {
220
224
  stdio: 'inherit'
@@ -223,9 +227,9 @@ program.name(pkg.name).description(pkg.description).version(pkg.version || 'work
223
227
  }
224
228
  const tech = detectAppTech();
225
229
  if (tech) {
226
- log.i(`Detected **${tech}** (https://rc.css.master.co/docs/installation/${tech})`);
230
+ log.i(`Detected **${tech}** (https://${BRANCH}.css.master.co/docs/installation/${tech})`);
227
231
  } else {
228
- log.i(`To integrate with your framework, check out the guides at **https://rc.css.master.co/docs/installation**`);
232
+ log.i(`To integrate with your framework, check out the guides at **https://${BRANCH}.css.master.co/docs/installation**`);
229
233
  }
230
234
  }
231
235
  });
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@master/create-css","type":"module","scripts":{"build":"techor build","dev":"pnpm build --watch","lint":"eslint ./src","type-check":"tsc --noEmit","test":"jest"},"license":"MIT","description":"Initialize a new Master CSS project","author":"Aoyue Design LLC.","funding":"https://css.master.co/docs/donate","homepage":"https://css.master.co","bugs":{"url":"https://github.com/master-co/css/issues"},"repository":{"type":"git","url":"https://github.com/master-co/css.git","directory":"packages/create"},"keywords":["cli","create","init","css","mastercss"],"bin":"./dist/bin/index.mjs","files":["dist"],"publishConfig":{"access":"public"},"dependencies":{"@master/css":"2.0.0-rc.13","@techor/fs":"^3.0.11","@techor/log":"^3.0.11","commander":"^12.0.0","detect-package-manager":"^3.0.1","giget":"^1.2.1","ora":"^8.0.1"},"devDependencies":{"css-shared":"^2.0.0-rc.16"},"version":"2.0.0-rc.16"}
1
+ {"name":"@master/create-css","type":"module","scripts":{"build":"techor build","dev":"pnpm build --watch","lint":"eslint ./src","type-check":"tsc --noEmit","test":"jest"},"license":"MIT","description":"Initialize a new Master CSS project","author":"Aoyue Design LLC.","funding":"https://css.master.co/docs/donate","homepage":"https://css.master.co","bugs":{"url":"https://github.com/master-co/css/issues"},"repository":{"type":"git","url":"https://github.com/master-co/css.git","directory":"packages/create"},"keywords":["cli","create","init","css","mastercss"],"bin":"./dist/bin/index.mjs","files":["dist"],"publishConfig":{"access":"public","provenance":true},"dependencies":{"@techor/fs":"^3.0.16","@techor/log":"^3.0.16","commander":"^12.0.0","detect-package-manager":"^3.0.1","giget":"^1.2.1","ora":"^8.0.1"},"devDependencies":{"css-shared":"^2.0.0-rc.19"},"version":"2.0.0-rc.19"}