ng-tailwindcss-jit
Advanced tools
Comparing version 0.0.1 to 0.0.2
63
index.js
@@ -5,4 +5,7 @@ #! /usr/bin/env node | ||
const packageJson = require("./package.json"); | ||
const { execSync } = require("child_process"); | ||
const ora = require("ora"); | ||
const { | ||
isRoot, | ||
isAlreadyConfigured, | ||
getPackageJson, | ||
@@ -13,11 +16,16 @@ updatePackageJson, | ||
} = require("./utils"); | ||
const { execSync } = require("child_process"); | ||
const { logSuccess, logError, logWarning } = require("./logging"); | ||
console.log(`ng-tailwindcss-jit v${packageJson.version}`); | ||
console.log(`${packageJson.name} v${packageJson.version}`); | ||
if (!isRoot()) { | ||
console.warn("Not running at project root"); | ||
logWarning("Not running at project root"); | ||
process.exit(); | ||
} | ||
if (isAlreadyConfigured()) { | ||
logWarning(`${packageJson.name} is already configured`); | ||
process.exit(); | ||
} | ||
const pkg = getPackageJson(); | ||
@@ -29,16 +37,16 @@ const installedPackages = [ | ||
// if (!installedPackages.includes("@angular/core")) { | ||
// console.warn("Not an angular project"); | ||
// process.exit(); | ||
// } | ||
if (!installedPackages.includes("@angular/core")) { | ||
logWarning("Not an angular project"); | ||
process.exit(); | ||
} | ||
// if (!installedPackages.includes("tailwindcss")) { | ||
// console.warn("Tailwind is not installed"); | ||
// process.exit(); | ||
// } | ||
if (!installedPackages.includes("tailwindcss")) { | ||
logWarning("Tailwind is not installed"); | ||
process.exit(); | ||
} | ||
// if (!pkg.scripts.start) { | ||
// console.warn("Start command not found"); | ||
// process.exit(); | ||
// } | ||
if (!pkg.scripts.start) { | ||
logWarning("Start command not found"); | ||
process.exit(); | ||
} | ||
@@ -54,11 +62,22 @@ pkg.scripts.start = `TAILWIND_MODE='watch' ${pkg.scripts.start}`; | ||
console.log("Installing @tailwindcss/jit"); | ||
if (!installedPackages.includes("@tailwindcss/jit")) { | ||
const spinner = ora({ | ||
text: "Installing @tailwindcss/jit\n", | ||
interval: 10, | ||
}).start(); | ||
spinner.color = "green"; | ||
try { | ||
execSync("node ./scripts/ng-tailwindcss-jit.js && npm i @tailwindcss/jit --save-dev"); | ||
} catch { | ||
console.log("Installation of @tailwindcss/jit failed"); | ||
process.exit(); | ||
try { | ||
execSync( | ||
"node ./scripts/ng-tailwindcss-jit.js && npm i @tailwindcss/jit --save-dev" | ||
); | ||
} catch { | ||
logError("Installation of @tailwindcss/jit failed"); | ||
process.exit(); | ||
} | ||
spinner.stop(); | ||
} else { | ||
execSync("node ./scripts/ng-tailwindcss-jit.js"); | ||
} | ||
console.log("Configured successfully"); | ||
logSuccess("Configured successfully"); |
{ | ||
"name": "ng-tailwindcss-jit", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Configures your angular project to use jit compiler for tailwindcss", | ||
@@ -11,6 +11,10 @@ "bin": { | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/apvarun/ng-tailwindcss-jit.git" | ||
}, | ||
"bugs": "https://github.com/apvarun/ng-tailwindcss-jit/issues", | ||
"keywords": [ | ||
"tailwindcss", | ||
"tailwindcss", | ||
"jit", | ||
"tailwindcss jit", | ||
"tailwind", | ||
@@ -23,4 +27,6 @@ "jit", | ||
"dependencies": { | ||
"fs-extra": "^9.1.0" | ||
"chalk": "^4.1.0", | ||
"fs-extra": "^9.1.0", | ||
"ora": "^5.4.0" | ||
} | ||
} |
@@ -5,4 +5,6 @@ # ng-tailwindcss-jit | ||
## Instructions | ||
![](./ng-tailwindcss-jit.png) | ||
## Usage | ||
``` | ||
@@ -14,7 +16,12 @@ npx ng-tailwindcss-jit | ||
- Project must have tailwindcss installed | ||
- Should be running the default angular builder | ||
- Project must have Twilwind CSS installed | ||
- Minimum angular version 11.2 (version from which angular supports Tailwind CSS out-of-the-box) | ||
- Should be using the default angular builder | ||
## Contributing | ||
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. | ||
## License | ||
[MIT](./LICENSE) | ||
This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details |
@@ -15,2 +15,8 @@ const path = require("path"); | ||
function isAlreadyConfigured() { | ||
const pkgPath = path.resolve("./scripts/ng-tailwindcss-jit.js"); | ||
return existsSync(pkgPath); | ||
} | ||
function getPackageJson() { | ||
@@ -57,2 +63,3 @@ const pkgPath = path.resolve("./package.json"); | ||
isRoot, | ||
isAlreadyConfigured, | ||
getPackageJson, | ||
@@ -59,0 +66,0 @@ updatePackageJson, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
23972
7
133
26
1
3
+ Addedchalk@^4.1.0
+ Addedora@^5.4.0
+ Addedansi-regex@5.0.1(transitive)
+ Addedansi-styles@4.3.0(transitive)
+ Addedbase64-js@1.5.1(transitive)
+ Addedbl@4.1.0(transitive)
+ Addedbuffer@5.7.1(transitive)
+ Addedchalk@4.1.2(transitive)
+ Addedcli-cursor@3.1.0(transitive)
+ Addedcli-spinners@2.9.2(transitive)
+ Addedclone@1.0.4(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addeddefaults@1.0.4(transitive)
+ Addedhas-flag@4.0.0(transitive)
+ Addedieee754@1.2.1(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedis-interactive@1.0.0(transitive)
+ Addedis-unicode-supported@0.1.0(transitive)
+ Addedlog-symbols@4.1.0(transitive)
+ Addedmimic-fn@2.1.0(transitive)
+ Addedonetime@5.1.2(transitive)
+ Addedora@5.4.1(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedrestore-cursor@3.1.0(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedstrip-ansi@6.0.1(transitive)
+ Addedsupports-color@7.2.0(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedwcwidth@1.0.1(transitive)