dorky 2.1.8 → 2.2.2
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.
- package/.github/workflows/publish.yml +6 -6
- package/README.md +8 -0
- package/bin/index.js +45 -17
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
name: "🚀 Publish on npm"
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
7
|
|
|
8
8
|
jobs:
|
|
9
9
|
release:
|
|
@@ -15,10 +15,10 @@ jobs:
|
|
|
15
15
|
- name: Setup node
|
|
16
16
|
uses: actions/setup-node@v3
|
|
17
17
|
with:
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
node-version: "24.x"
|
|
19
|
+
registry-url: "https://registry.npmjs.org"
|
|
20
20
|
- run: npm install
|
|
21
21
|
- name: 🚀 publish
|
|
22
22
|
run: npm publish --access public
|
|
23
23
|
env:
|
|
24
|
-
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
|
|
24
|
+
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
|
package/README.md
CHANGED
|
@@ -84,5 +84,13 @@ Anyhow, we shall store it on a private storage, using **dorky**, that stores it
|
|
|
84
84
|
|
|
85
85
|
## To-Do
|
|
86
86
|
|
|
87
|
+
[*] List remote files in dorky bucket.
|
|
88
|
+
[*] Auto detect .env and .config files.
|
|
89
|
+
[*] Update node version to latest LTS.
|
|
90
|
+
[ ] Handle errors.
|
|
91
|
+
[ ] Extension for VS Code to list and highlight them like git.
|
|
92
|
+
[ ] Unintialize dorky setup.
|
|
93
|
+
[ ] MCP server.
|
|
94
|
+
[ ] Encryption of files.
|
|
87
95
|
[ ] Add stages for variables.
|
|
88
96
|
|
package/bin/index.js
CHANGED
|
@@ -38,7 +38,6 @@ console.log(chalk.bgHex(randomColor)(usage));
|
|
|
38
38
|
if (process.argv.slice(2).length === 0) {
|
|
39
39
|
process.argv.push("--help");
|
|
40
40
|
}
|
|
41
|
-
|
|
42
41
|
var args = yargs
|
|
43
42
|
.option("init", { alias: "i", describe: "Initialize dorky project", type: "string", demandOption: false })
|
|
44
43
|
.option("list", { alias: "l", describe: "List files in dorky", type: "string", demandOption: false })
|
|
@@ -47,6 +46,15 @@ var args = yargs
|
|
|
47
46
|
.option("push", { alias: "ph", describe: "Push files to storage", type: "string", demandOption: false })
|
|
48
47
|
.option("pull", { alias: "pl", describe: "Pull files from storage", type: "string", demandOption: false })
|
|
49
48
|
.option("migrate", { alias: "m", describe: "Migrate dorky project to another storage", type: "string", demandOption: false })
|
|
49
|
+
.example('$0 --init aws', 'Initialize a dorky project with AWS storage')
|
|
50
|
+
.example('$0 --init google-drive', 'Initialize a dorky project with Google Drive storage')
|
|
51
|
+
.example('$0 --list', 'List local files that can be added and already added files')
|
|
52
|
+
.example('$0 --list remote', 'List files in remote storage')
|
|
53
|
+
.example('$0 --add file1.txt file2.js', 'Add specific files to stage-1')
|
|
54
|
+
.example('$0 --rm file1.txt', 'Remove a file from stage-1')
|
|
55
|
+
.example('$0 --push', 'Push staged files to storage')
|
|
56
|
+
.example('$0 --pull', 'Pull files from storage')
|
|
57
|
+
.example('$0 --migrate aws', 'Migrate the project to AWS storage')
|
|
50
58
|
.help('help')
|
|
51
59
|
.strict()
|
|
52
60
|
.argv
|
|
@@ -118,24 +126,44 @@ async function init(storage) {
|
|
|
118
126
|
}
|
|
119
127
|
}
|
|
120
128
|
|
|
121
|
-
async function list() {
|
|
129
|
+
async function list(type) {
|
|
122
130
|
checkIfDorkyProject();
|
|
123
|
-
console.log(chalk.red("Listing files that can be added:"));
|
|
124
|
-
var exclusions = fs.readFileSync(".dorkyignore").toString().split(EOL);
|
|
125
|
-
exclusions = exclusions.filter((exclusion) => exclusion !== "");
|
|
126
|
-
const src = process.cwd();
|
|
127
|
-
const files = await glob(path.join(src, "**/*"), { dot: true });
|
|
128
|
-
const filteredFiles = files.filter((file) => {
|
|
129
|
-
for (let i = 0; i < exclusions.length; i++) {
|
|
130
|
-
if (file.includes(exclusions[i])) return false;
|
|
131
|
-
}
|
|
132
|
-
return true;
|
|
133
|
-
});
|
|
134
|
-
filteredFiles.forEach((file) => console.log(chalk.red(`- ${path.relative(process.cwd(), file)}`)));
|
|
135
|
-
console.log(chalk.green("\nList of files that are already added:"));
|
|
136
131
|
const metaData = JSON.parse(fs.readFileSync(".dorky/metadata.json"));
|
|
137
|
-
|
|
138
|
-
|
|
132
|
+
switch (type) {
|
|
133
|
+
case "remote":
|
|
134
|
+
const uploadedFiles = Object.keys(metaData["uploaded-files"]);
|
|
135
|
+
if (uploadedFiles.length === 0) {
|
|
136
|
+
console.log(chalk.red("No files found in remote storage."));
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
console.log(chalk.green("Listing files in stage-1:"));
|
|
140
|
+
uploadedFiles.forEach((file) => console.log(chalk.green(`- ${file}`)));
|
|
141
|
+
break;
|
|
142
|
+
default:
|
|
143
|
+
console.log(chalk.red("Listing files that can be added:"));
|
|
144
|
+
var exclusions = fs.readFileSync(".dorkyignore").toString().split(EOL);
|
|
145
|
+
exclusions = exclusions.filter((exclusion) => exclusion !== "");
|
|
146
|
+
const src = process.cwd();
|
|
147
|
+
const files = await glob(path.join(src, "**/*"), { dot: true });
|
|
148
|
+
const filteredFiles = files.filter((file) => {
|
|
149
|
+
for (let i = 0; i < exclusions.length; i++) {
|
|
150
|
+
if (file.includes(exclusions[i])) return false;
|
|
151
|
+
}
|
|
152
|
+
return true;
|
|
153
|
+
});
|
|
154
|
+
filteredFiles.forEach((file) => {
|
|
155
|
+
const relativePath = path.relative(process.cwd(), file);
|
|
156
|
+
if (relativePath.includes('.env') || relativePath.includes('.config')) {
|
|
157
|
+
console.log(chalk.bold.bgYellowBright.red(`- ${relativePath} (This file might be sensitive, please add it to dorky if needed)`));
|
|
158
|
+
} else {
|
|
159
|
+
console.log(chalk.red(`- ${relativePath}`));
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
console.log(chalk.green("\nList of files that are already added:"));
|
|
163
|
+
const addedFiles = Object.keys(metaData["stage-1-files"]);
|
|
164
|
+
addedFiles.forEach((file) => console.log(chalk.green(`- ${file}`)));
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
139
167
|
}
|
|
140
168
|
|
|
141
169
|
function add(listOfFiles) {
|