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

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.
Files changed (2) hide show
  1. package/dist/bin/index.mjs +18 -16
  2. package/package.json +1 -1
@@ -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
  }
@@ -187,6 +188,7 @@ program.name(pkg.name).description(pkg.description).version(pkg.version || 'work
187
188
  throw error;
188
189
  }
189
190
  } else {
191
+ const appPkg = readJSONFileSync('package.json');
190
192
  options.ext = options.ext || detectAppExt();
191
193
  const create = (fileName, text)=>{
192
194
  const configExists = existsSync$1(fileName);
@@ -214,7 +216,7 @@ program.name(pkg.name).description(pkg.description).version(pkg.version || 'work
214
216
  }
215
217
  if (!appPkg?.dependencies?.['@master/css']) {
216
218
  log.i(`Detected **${options.pm}**`);
217
- log.i`Start "${options.pm} add @master/css@rc"`;
219
+ log.i`Start "${options.pm} add @master/css@${BRANCH}"`;
218
220
  log``;
219
221
  execSync(`${options.pm} add @master/css@rc`, {
220
222
  stdio: 'inherit'
@@ -223,9 +225,9 @@ program.name(pkg.name).description(pkg.description).version(pkg.version || 'work
223
225
  }
224
226
  const tech = detectAppTech();
225
227
  if (tech) {
226
- log.i(`Detected **${tech}** (https://rc.css.master.co/docs/installation/${tech})`);
228
+ log.i(`Detected **${tech}** (https://${BRANCH}.css.master.co/docs/installation/${tech})`);
227
229
  } else {
228
- log.i(`To integrate with your framework, check out the guides at **https://rc.css.master.co/docs/installation**`);
230
+ log.i(`To integrate with your framework, check out the guides at **https://${BRANCH}.css.master.co/docs/installation**`);
229
231
  }
230
232
  }
231
233
  });
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"},"dependencies":{"@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.17"},"version":"2.0.0-rc.17"}