Skip to content

Commit

Permalink
repairs to installing due to expecting nodejs on npm bug
Browse files Browse the repository at this point in the history
  • Loading branch information
onzag committed Nov 7, 2020
1 parent 7bcd236 commit 0a503ff
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr/bin/env node

// Hack file to call the nodejs itemize index executable because
// npm will attempt to use the index file before it even exists
// and there seems no way to tell npm not to do so
require("./nodejs/index");
require("./nodejs/main");
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "@onzag/itemize",
"version": "0.0.106.slate",
"version": "0.0.113.slate",
"description": "Itemize",
"bin": {
"itemize": "./nodejs/main.js"
"itemize": "index.js"
},
"main": "index",
"types": "nodejs/index",
"scripts": {
"install": "tsc && node ./sass-handler.js"
"install": "tsc && node ./sass-json-handler.js"
},
"author": "Onza Systems - Edward Gonzalez",
"license": "AGPL3",
Expand Down
11 changes: 9 additions & 2 deletions sass-handler.js → sass-json-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ function walkDirectory(directory, targetDirectory) {
list.forEach((filename) => {
const filepath = path.resolve(directory, filename);
const outFilePath = path.resolve(targetDirectory, filename);
if (filename.endsWith(".scss") || filename.endsWith(".sass") || filename.endsWith(".css")) {
if (filename.endsWith(".scss") || filename.endsWith(".sass") || filename.endsWith(".css") || filename.endsWith(".json")) {
console.log("outputting", outFilePath);
fs.writeFile(outFilePath, "", () => {});
if (filename.endsWith(".json")) {
const content = fs.readFileSync(filepath, "utf-8");
fs.writeFile(outFilePath, content, () => {});
} else {
fs.writeFile(outFilePath, "", () => {});
}
} else {
fs.stat(filepath, (err, stat) => {
if (stat && stat.isDirectory()) {
Expand All @@ -40,4 +45,6 @@ function walkDirectory(directory, targetDirectory) {
});
}

// corruption that occurs during the npm install process with forgets these files
walkDirectory("imported-resources", path.join("nodejs", "imported-resources"));
walkDirectory("client", path.join("nodejs", "client"));

0 comments on commit 0a503ff

Please sign in to comment.