Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

create-salt-project

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-salt-project - npm Package Compare versions

Comparing version 1.0.5 to 1.0.6

64

dist/package.json
{
"name": "create-salt-project",
"version": "1.0.5",
"description": "",
"bin": {
"create-salt-project": "./dist/src/index.js",
"salt-project": "./dist/src/index.js"
},
"main": "./dist/src/index.js",
"type": "module",
"scripts": {
"dev": "rm -rf dist && tsc -w",
"link-cli": "pnpm link --global && cp package.json dist/package.json",
"publish-cli": "pnpm version patch && cp package.json dist/package.json && pnpm publish --access public --no-git-checks"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@types/chalk": "^2.2.0",
"@types/figlet": "^1.5.8",
"@types/inquirer": "^9.0.7",
"@types/node": "^20.11.27",
"@types/ora": "^3.2.0",
"typescript": "^5.4.2"
},
"dependencies": {
"chalk": "^5.3.0",
"figlet": "^1.7.0",
"inquirer": "^9.2.16",
"ora": "^8.0.1",
"rxjs": "^7.8.1"
}
"name": "create-salt-project",
"version": "1.0.5",
"description": "",
"bin": {
"create-salt-project": "./dist/src/index.js",
"salt-project": "./dist/src/index.js"
},
"main": "./dist/src/index.js",
"type": "module",
"scripts": {
"dev": "rm -rf dist && tsc -w",
"link-cli": "pnpm link --global && cp package.json dist/package.json",
"publish-cli": "pnpm version patch && cp package.json dist/package.json && pnpm publish --access public --no-git-checks"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@types/chalk": "^2.2.0",
"@types/figlet": "^1.5.8",
"@types/inquirer": "^9.0.7",
"@types/node": "^20.11.27",
"@types/ora": "^3.2.0",
"typescript": "^5.4.2"
},
"dependencies": {
"chalk": "^5.3.0",
"figlet": "^1.7.0",
"inquirer": "^9.2.16",
"ora": "^8.0.1",
"rxjs": "^7.8.1"
}
}

@@ -16,2 +16,3 @@ #! /usr/bin/env node

const answers = await inquirer.prompt(questions);
answers.CWD = process.cwd();
if (answers.projectFramework === "next.js") {

@@ -18,0 +19,0 @@ project = new NextProject(answers);

@@ -1,2 +0,2 @@

import { execCommand, execCommandOnProject, log, spinner } from "../utils.js";
import { execCommand, execCommandOnProject, execWriteFile, log, spinner, } from "../utils.js";
import { BaseProject } from "./base.js";

@@ -14,5 +14,5 @@ export class AngularProject extends BaseProject {

await execCommand(commandInstall);
await execCommandOnProject(this.answers)(`echo "<div className='flex w-screen h-screen items-center justify-center'>
<h1 className='text-3xl font-bold text-center'>Hello Salters!</h1>
</div>" > src/app/app.component.html`);
await execWriteFile(this.answers, "src/app/app.component.html", `<div className='flex w-screen h-screen items-center justify-center'>
<h1 className='text-3xl font-bold text-center'>Hello Salters!</h1>
</div>`);
angularSpinner.stop();

@@ -24,3 +24,3 @@ log("✔ Project created successfully!");

await execCommandOnProject(this.answers)(`ng generate config karma`);
const packageJson = JSON.parse((await execCommandOnProject(this.answers)("cat package.json")));
const packageJson = require(this.answers.CWD + "/package.json");
packageJson.scripts = {

@@ -31,3 +31,3 @@ ...packageJson.scripts,

};
await execCommandOnProject(this.answers)(`echo "${JSON.stringify(JSON.stringify(packageJson))}" > package.json`);
await execWriteFile(this.answers, "package.json", JSON.stringify(packageJson));
loadingSpinner.stop();

@@ -34,0 +34,0 @@ log("✔ Testing configuration created successfully!");

import { log } from "console";
import { commandInstallPackageLiteral, commandRun, execCommandOnProject, spinner, } from "../utils.js";
import { commandInstallPackageLiteral, commandRun, execCommandOnProject, execWriteFile, spinner, } from "../utils.js";
export class BaseProject {

@@ -332,8 +332,8 @@ answers;

await execCommandOnProject(this.answers)(`${this.commanInstallLinterLiteral[this.answers.packageManager]}`);
await execCommandOnProject(this.answers)(`echo "${JSON.stringify(JSON.stringify(this.eslintConfiguration))}" > .eslintrc.json`);
await execCommandOnProject(this.answers)(`echo "${this.lintStagedConfiguration}" > .lintstagedrc.js`);
const packageJson = JSON.parse((await execCommandOnProject(this.answers)("cat package.json")));
await execWriteFile(this.answers, ".eslintrc.json", JSON.stringify(this.eslintConfiguration));
await execWriteFile(this.answers, ".lintstagedrc.js", this.lintStagedConfiguration);
const packageJson = require(this.answers.CWD + "/package.json");
packageJson.scripts.lint = "eslint .";
packageJson.scripts.lintfix = "eslint . --fix";
await execCommandOnProject(this.answers)(`echo "${JSON.stringify(JSON.stringify(packageJson))}" > package.json`);
await execWriteFile(this.answers, "package.json", JSON.stringify(packageJson));
loadingSpinner.stop();

@@ -345,7 +345,7 @@ log("✔ Linter configuration created successfully!");

await execCommandOnProject(this.answers)(`${this.commandInstallFormatterLiteral[this.answers.packageManager]}`);
await execCommandOnProject(this.answers)(`echo "${JSON.stringify(JSON.stringify(this.formatterConfiguration))}" > .prettierrc.json`);
const packageJson = JSON.parse((await execCommandOnProject(this.answers)("cat package.json")));
await execWriteFile(this.answers, ".prettierrc.json", JSON.stringify(this.formatterConfiguration));
const packageJson = require(this.answers.CWD + "/package.json");
packageJson.scripts.format =
'prettier --write "./**/*.{js,jsx,ts,tsx,css,scss,md,json}" .';
await execCommandOnProject(this.answers)(`echo "${JSON.stringify(JSON.stringify(packageJson))}" > package.json`);
await execWriteFile(this.answers, "package.json", JSON.stringify(packageJson));
loadingSpinner.stop();

@@ -357,4 +357,4 @@ log("✔ Formatter configuration created successfully!");

await execCommandOnProject(this.answers)(`${this.tailwindInstallCommands[this.answers.packageManager]} && npx tailwindcss init -p`);
await execCommandOnProject(this.answers)(`echo "${this.tailwindConfigString}" > tailwind.config.js`);
await execCommandOnProject(this.answers)(`echo "${this.tailwindClassCss}" > ${this.fileStylesPath}`);
await execWriteFile(this.answers, "tailwind.config.js", this.tailwindConfigString);
await execWriteFile(this.answers, this.fileStylesPath, this.tailwindClassCss);
loadingSpinner.stop();

@@ -372,4 +372,3 @@ log("✔ Tailwind configuration created successfully!");

await execCommandOnProject(this.answers)(this.commandsInstallPrecommitLiteral[this.answers.packageManager]);
let packageJsonString = (await execCommandOnProject(this.answers)("cat package.json"));
let packageJsonObject = JSON.parse(packageJsonString);
let packageJsonObject = require(this.answers.CWD + "/package.json");
if (this.answers.packageManager === "yarn") {

@@ -381,10 +380,9 @@ this.createPostinstallScript(packageJsonObject);

}
await execCommandOnProject(this.answers)(`echo ${JSON.stringify(JSON.stringify(packageJsonObject))} > package.json`);
await execWriteFile(this.answers, "package.json", JSON.stringify(packageJsonObject));
await execCommandOnProject(this.answers)(this.commandConfigPrecommitLiteral[this.answers.packageManager]);
const commitMessage = `echo "\n🛠️ Precommit Running! Please wait..."\nnpx lint-staged`;
await execCommandOnProject(this.answers)(`echo ${JSON.stringify(commitMessage)} > .husky/pre-commit`);
packageJsonString = (await execCommandOnProject(this.answers)("cat package.json"));
packageJsonObject = JSON.parse(packageJsonString);
await execWriteFile(this.answers, ".husky/pre-commit", commitMessage);
packageJsonObject = require(this.answers.CWD + "/package.json");
await this.createSaltPrecommit(this.answers, packageJsonObject);
await execCommandOnProject(this.answers)(`echo ${JSON.stringify(JSON.stringify(packageJsonObject))} > package.json`);
await execWriteFile(this.answers, "package.json", JSON.stringify(packageJsonObject));
loadingSpinner.stop();

@@ -391,0 +389,0 @@ log("✔ Pre-commit configuration created successfully!");

@@ -1,2 +0,2 @@

import { execCommand, execCommandOnProject, log, spinner } from "../utils.js";
import { execCommand, execCommandOnProject, execWriteFile, log, spinner, } from "../utils.js";
import { BaseProject } from "./base.js";

@@ -85,15 +85,15 @@ export class NextProject extends BaseProject {

await execCommandOnProject(this.answers)(`rm src/styles/Home.module.css`);
await execCommandOnProject(this.answers)(`echo "export default function Home() {
return (
<div className='flex w-screen h-screen items-center justify-center'>
<h1 className='text-3xl font-bold text-center'>Hello Salters!</h1>
</div>
);
}" > src/pages/index.tsx`);
await execCommandOnProject(this.answers)(`echo "import '@${this.answers.projectName}/styles/globals.scss';
import type { AppProps } from 'next/app';
export default function App({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />;
}" > src/pages/_app.tsx`);
await execWriteFile(this.answers, "src/pages/index.tsx", `export default function Home() {
return (
<div className='flex w-screen h-screen items-center justify-center'>
<h1 className='text-3xl font-bold text-center'>Hello Salters!</h1>
</div>
);
}`);
await execWriteFile(this.answers, "src/pages/_app.tsx", `import '@${this.answers.projectName}/styles/globals.scss';
import type { AppProps } from 'next/app';
export default function App({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />;
}`);
await execCommandOnProject(this.answers)(`${this.commandInstallScssLiteral[this.answers.packageManager]}`);

@@ -106,5 +106,5 @@ loadingSpinner.stop();

await execCommandOnProject(this.answers)(`${this.commandInstalTestingLiteral[this.answers.packageManager]}`);
await execCommandOnProject(this.answers)(`echo "${this.jestConfigFnString(this.answers)}" > jest.config.ts`);
await execCommandOnProject(this.answers)(`echo "${this.jestSetupString}" > jest.setup.ts`);
const packageJson = JSON.parse((await execCommandOnProject(this.answers)("cat package.json")));
await execWriteFile(this.answers, "jest.config.ts", this.jestConfigFnString(this.answers));
await execWriteFile(this.answers, "jest.setup.ts", this.jestSetupString);
const packageJson = require(this.answers.CWD + "/package.json");
packageJson.scripts = {

@@ -115,3 +115,3 @@ ...packageJson.scripts,

};
await execCommandOnProject(this.answers)(`echo "${JSON.stringify(JSON.stringify(packageJson))}" > package.json`);
await execWriteFile(this.answers, "package.json", JSON.stringify(packageJson));
loadingSpinner.stop();

@@ -118,0 +118,0 @@ log("✔ Testing configuration created successfully!");

import { exec } from "child_process";
import ora from "ora";
import { writeFileSync } from "fs";
export const log = console.log;

@@ -34,1 +35,6 @@ export const projectOptions = [

};
export const execWriteFile = async (answer, fileName, value) => {
await writeFileSync(`${answer.CWD}/${fileName}`, value, {
encoding: "utf-8",
});
};
{
"name": "create-salt-project",
"version": "1.0.5",
"version": "1.0.6",
"description": "",

@@ -5,0 +5,0 @@ "bin": {

@@ -28,2 +28,3 @@ #! /usr/bin/env node

const answers: TAnswers = await inquirer.prompt(questions);
answers.CWD = process.cwd();

@@ -30,0 +31,0 @@ if (answers.projectFramework === "next.js") {

import { TAnswers } from "../types.js";
import { execCommand, execCommandOnProject, log, spinner } from "../utils.js";
import {
execCommand,
execCommandOnProject,
execWriteFile,
log,
spinner,
} from "../utils.js";
import { BaseProject } from "./base.js";

@@ -20,6 +26,14 @@

await execCommandOnProject(this.answers)(
`echo "<div className='flex w-screen h-screen items-center justify-center'>
<h1 className='text-3xl font-bold text-center'>Hello Salters!</h1>
</div>" > src/app/app.component.html`
// await execCommandOnProject(this.answers)(
// `echo "<div className='flex w-screen h-screen items-center justify-center'>
// <h1 className='text-3xl font-bold text-center'>Hello Salters!</h1>
// </div>" > src/app/app.component.html`
// );
await execWriteFile(
this.answers,
"src/app/app.component.html",
`<div className='flex w-screen h-screen items-center justify-center'>
<h1 className='text-3xl font-bold text-center'>Hello Salters!</h1>
</div>`
);

@@ -37,8 +51,10 @@

const packageJson = JSON.parse(
(await execCommandOnProject(this.answers)(
"cat package.json"
)) as unknown as string
);
// const packageJson = JSON.parse(
// (await execCommandOnProject(this.answers)(
// "cat package.json"
// )) as unknown as string
// );
const packageJson = require(this.answers.CWD + "/package.json");
packageJson.scripts = {

@@ -51,4 +67,10 @@ ...packageJson.scripts,

await execCommandOnProject(this.answers)(
`echo "${JSON.stringify(JSON.stringify(packageJson))}" > package.json`
// await execCommandOnProject(this.answers)(
// `echo "${JSON.stringify(JSON.stringify(packageJson))}" > package.json`
// );
await execWriteFile(
this.answers,
"package.json",
JSON.stringify(packageJson)
);

@@ -55,0 +77,0 @@

@@ -7,4 +7,6 @@ import { log } from "console";

execCommandOnProject,
execWriteFile,
spinner,
} from "../utils.js";
import { writeFileSync } from "fs";

@@ -400,23 +402,43 @@ export interface BaseProjectI {

await execCommandOnProject(this.answers)(
`echo "${JSON.stringify(
JSON.stringify(this.eslintConfiguration)
)}" > .eslintrc.json`
);
// await execCommandOnProject(this.answers)(
// `echo "${JSON.stringify(
// JSON.stringify(this.eslintConfiguration)
// )}" > .eslintrc.json`
// );
await execCommandOnProject(this.answers)(
`echo "${this.lintStagedConfiguration}" > .lintstagedrc.js`
await execWriteFile(
this.answers,
".eslintrc.json",
JSON.stringify(this.eslintConfiguration)
);
const packageJson = JSON.parse(
(await execCommandOnProject(this.answers)(
"cat package.json"
)) as unknown as string
// await execCommandOnProject(this.answers)(
// `echo "${this.lintStagedConfiguration}" > .lintstagedrc.js`
// );
await execWriteFile(
this.answers,
".lintstagedrc.js",
this.lintStagedConfiguration
);
// const packageJson = JSON.parse(
// (await execCommandOnProject(this.answers)(
// "cat package.json"
// )) as unknown as string
// );
const packageJson = require(this.answers.CWD + "/package.json");
packageJson.scripts.lint = "eslint .";
packageJson.scripts.lintfix = "eslint . --fix";
await execCommandOnProject(this.answers)(
`echo "${JSON.stringify(JSON.stringify(packageJson))}" > package.json`
// await execCommandOnProject(this.answers)(
// `echo "${JSON.stringify(JSON.stringify(packageJson))}" > package.json`
// );
await execWriteFile(
this.answers,
"package.json",
JSON.stringify(packageJson)
);

@@ -437,19 +459,33 @@

await execCommandOnProject(this.answers)(
`echo "${JSON.stringify(
JSON.stringify(this.formatterConfiguration)
)}" > .prettierrc.json`
);
// await execCommandOnProject(this.answers)(
// `echo "${JSON.stringify(
// JSON.stringify(this.formatterConfiguration)
// )}" > .prettierrc.json`
// );
const packageJson = JSON.parse(
(await execCommandOnProject(this.answers)(
"cat package.json"
)) as unknown as string
await execWriteFile(
this.answers,
".prettierrc.json",
JSON.stringify(this.formatterConfiguration)
);
// const packageJson = JSON.parse(
// (await execCommandOnProject(this.answers)(
// "cat package.json"
// )) as unknown as string
// );
const packageJson = require(this.answers.CWD + "/package.json");
packageJson.scripts.format =
'prettier --write "./**/*.{js,jsx,ts,tsx,css,scss,md,json}" .';
await execCommandOnProject(this.answers)(
`echo "${JSON.stringify(JSON.stringify(packageJson))}" > package.json`
// await execCommandOnProject(this.answers)(
// `echo "${JSON.stringify(JSON.stringify(packageJson))}" > package.json`
// );
await execWriteFile(
this.answers,
"package.json",
JSON.stringify(packageJson)
);

@@ -471,8 +507,20 @@

await execCommandOnProject(this.answers)(
`echo "${this.tailwindConfigString}" > tailwind.config.js`
// await execCommandOnProject(this.answers)(
// `echo "${this.tailwindConfigString}" > tailwind.config.js`
// );
await execWriteFile(
this.answers,
"tailwind.config.js",
this.tailwindConfigString
);
await execCommandOnProject(this.answers)(
`echo "${this.tailwindClassCss}" > ${this.fileStylesPath}`
// await execCommandOnProject(this.answers)(
// `echo "${this.tailwindClassCss}" > ${this.fileStylesPath}`
// );
await execWriteFile(
this.answers,
this.fileStylesPath,
this.tailwindClassCss
);

@@ -506,8 +554,10 @@

let packageJsonString: string = (await execCommandOnProject(this.answers)(
"cat package.json"
)) as unknown as string;
// let packageJsonString: string = (await execCommandOnProject(this.answers)(
// "cat package.json"
// )) as unknown as string;
let packageJsonObject = JSON.parse(packageJsonString);
// let packageJsonObject = JSON.parse(packageJsonString);
let packageJsonObject = require(this.answers.CWD + "/package.json");
if (this.answers.packageManager === "yarn") {

@@ -519,4 +569,10 @@ this.createPostinstallScript(packageJsonObject);

await execCommandOnProject(this.answers)(
`echo ${JSON.stringify(JSON.stringify(packageJsonObject))} > package.json`
// await execCommandOnProject(this.answers)(
// `echo ${JSON.stringify(JSON.stringify(packageJsonObject))} > package.json`
// );
await execWriteFile(
this.answers,
"package.json",
JSON.stringify(packageJsonObject)
);

@@ -530,16 +586,24 @@

await execCommandOnProject(this.answers)(
`echo ${JSON.stringify(commitMessage)} > .husky/pre-commit`
);
// await execCommandOnProject(this.answers)(
// `echo ${JSON.stringify(commitMessage)} > .husky/pre-commit`
// );
packageJsonString = (await execCommandOnProject(this.answers)(
"cat package.json"
)) as unknown as string;
await execWriteFile(this.answers, ".husky/pre-commit", commitMessage);
packageJsonObject = JSON.parse(packageJsonString);
// packageJsonString = (await execCommandOnProject(this.answers)(
// "cat package.json"
// )) as unknown as string;
packageJsonObject = require(this.answers.CWD + "/package.json");
await this.createSaltPrecommit(this.answers, packageJsonObject);
await execCommandOnProject(this.answers)(
`echo ${JSON.stringify(JSON.stringify(packageJsonObject))} > package.json`
// await execCommandOnProject(this.answers)(
// `echo ${JSON.stringify(JSON.stringify(packageJsonObject))} > package.json`
// );
await execWriteFile(
this.answers,
"package.json",
JSON.stringify(packageJsonObject)
);

@@ -546,0 +610,0 @@

import { TAnswers } from "../types.js";
import { execCommand, execCommandOnProject, log, spinner } from "../utils.js";
import {
execCommand,
execCommandOnProject,
execWriteFile,
log,
spinner,
} from "../utils.js";
import { BaseProject } from "./base.js";

@@ -110,10 +116,22 @@

await execCommandOnProject(this.answers)(
`echo "export default function Home() {
return (
<div className='flex w-screen h-screen items-center justify-center'>
<h1 className='text-3xl font-bold text-center'>Hello Salters!</h1>
</div>
);
}" > src/pages/index.tsx`
// await execCommandOnProject(this.answers)(
// `echo "export default function Home() {
// return (
// <div className='flex w-screen h-screen items-center justify-center'>
// <h1 className='text-3xl font-bold text-center'>Hello Salters!</h1>
// </div>
// );
// }" > src/pages/index.tsx`
// );
await execWriteFile(
this.answers,
"src/pages/index.tsx",
`export default function Home() {
return (
<div className='flex w-screen h-screen items-center justify-center'>
<h1 className='text-3xl font-bold text-center'>Hello Salters!</h1>
</div>
);
}`
);

@@ -125,9 +143,20 @@

await execCommandOnProject(this.answers)(
`echo "import '@${this.answers.projectName}/styles/globals.scss';
import type { AppProps } from 'next/app';
export default function App({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />;
}" > src/pages/_app.tsx`
// await execCommandOnProject(this.answers)(
// `echo "import '@${this.answers.projectName}/styles/globals.scss';
// import type { AppProps } from 'next/app';
// export default function App({ Component, pageProps }: AppProps) {
// return <Component {...pageProps} />;
// }" > src/pages/_app.tsx`
// );
await execWriteFile(
this.answers,
"src/pages/_app.tsx",
`import '@${this.answers.projectName}/styles/globals.scss';
import type { AppProps } from 'next/app';
export default function App({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />;
}`
);

@@ -156,16 +185,26 @@

await execCommandOnProject(this.answers)(
`echo "${this.jestConfigFnString(this.answers)}" > jest.config.ts`
);
// await execCommandOnProject(this.answers)(
// `echo "${this.jestConfigFnString(this.answers)}" > jest.config.ts`
// );
await execCommandOnProject(this.answers)(
`echo "${this.jestSetupString}" > jest.setup.ts`
await execWriteFile(
this.answers,
"jest.config.ts",
this.jestConfigFnString(this.answers)
);
const packageJson = JSON.parse(
(await execCommandOnProject(this.answers)(
"cat package.json"
)) as unknown as string
);
// await execCommandOnProject(this.answers)(
// `echo "${this.jestSetupString}" > jest.setup.ts`
// );
await execWriteFile(this.answers, "jest.setup.ts", this.jestSetupString);
// const packageJson = JSON.parse(
// (await execCommandOnProject(this.answers)(
// "cat package.json"
// )) as unknown as string
// );
const packageJson = require(this.answers.CWD + "/package.json");
packageJson.scripts = {

@@ -177,4 +216,10 @@ ...packageJson.scripts,

await execCommandOnProject(this.answers)(
`echo "${JSON.stringify(JSON.stringify(packageJson))}" > package.json`
// await execCommandOnProject(this.answers)(
// `echo "${JSON.stringify(JSON.stringify(packageJson))}" > package.json`
// );
await execWriteFile(
this.answers,
"package.json",
JSON.stringify(packageJson)
);

@@ -181,0 +226,0 @@

@@ -6,2 +6,3 @@ export type TAnswers = {

projectJiraKey: string;
CWD: string;
};
import { exec } from "child_process";
import ora from "ora";
import { TAnswers } from "./types.js";
import { writeFileSync } from "fs";

@@ -44,1 +45,11 @@ export const log = console.log;

};
export const execWriteFile = async (
answer: TAnswers,
fileName: string,
value: string
) => {
await writeFileSync(`${answer.CWD}/${fileName}`, value, {
encoding: "utf-8",
});
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc