Skip to content

Commit

Permalink
default yarn to instructions (#10)
Browse files Browse the repository at this point in the history
* default to yarn for now

* build the distrobution files, this by the way includes the change to allow dash in project names
  • Loading branch information
trebor authored Jan 5, 2024
1 parent a5da0d7 commit dae1fc0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions dist/main.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ async function init() {
]);
const root = path__default.join(projectDir, results.projectName);
const pkgInfo = pkgFromUserAgent(process.env["npm_config_user_agent"]);
const pkgManager = pkgInfo ? pkgInfo.name : "npm";
const pkgManager = pkgInfo ? pkgInfo.name : "yarn";
const templateDir = path__default.resolve(
node_url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('main.cjs', document.baseURI).href))),
"../../template"
Expand Down Expand Up @@ -83,8 +83,8 @@ function validateProjectName(projectDir, projectName) {
if (projectName.length === 0) {
return "Project name must be at least 1 character long.";
}
if (!/^([^0-9\W]\w*)$/.test(projectName)) {
return "Project name must contain only alphanumerics or underscore with no leading digits.";
if (!/^([^0-9\W][\w-]*)$/.test(projectName)) {
return "Project name must contain only alphanumerics, dash or underscore with no leading digits.";
}
return true;
}
Expand Down
6 changes: 3 additions & 3 deletions dist/main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async function init() {
]);
const root = path.join(projectDir, results.projectName);
const pkgInfo = pkgFromUserAgent(process.env["npm_config_user_agent"]);
const pkgManager = pkgInfo ? pkgInfo.name : "npm";
const pkgManager = pkgInfo ? pkgInfo.name : "yarn";
const templateDir = path.resolve(
fileURLToPath(import.meta.url),
"../../template"
Expand Down Expand Up @@ -74,8 +74,8 @@ function validateProjectName(projectDir, projectName) {
if (projectName.length === 0) {
return "Project name must be at least 1 character long.";
}
if (!/^([^0-9\W]\w*)$/.test(projectName)) {
return "Project name must contain only alphanumerics or underscore with no leading digits.";
if (!/^([^0-9\W][\w-]*)$/.test(projectName)) {
return "Project name must contain only alphanumerics, dash or underscore with no leading digits.";
}
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async function init() {

const root = path.join(projectDir, results.projectName);
const pkgInfo = pkgFromUserAgent(process.env["npm_config_user_agent"]);
const pkgManager = pkgInfo ? pkgInfo.name : "npm";
const pkgManager = pkgInfo ? pkgInfo.name : "yarn";

const templateDir = path.resolve(
fileURLToPath(import.meta.url),
Expand Down

0 comments on commit dae1fc0

Please sign in to comment.