refactor: rely on component versions from checksums file (#1111)

This commit is contained in:
Mo
2022-06-16 11:56:32 -05:00
committed by GitHub
parent 6921c6abe1
commit dc10a5cb25
738 changed files with 389 additions and 381 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -6,7 +6,7 @@
"packages": [ "packages": [
"packages/*", "packages/*",
"packages/desktop/app", "packages/desktop/app",
"packages/components/src/*" "packages/components/src/packages/*"
] ]
}, },
"engines": { "engines": {
@@ -29,7 +29,8 @@
"release:beta": "lerna version --conventional-prerelease --conventional-commits --yes -m \"chore(release): publish\"", "release:beta": "lerna version --conventional-prerelease --conventional-commits --yes -m \"chore(release): publish\"",
"version": "yarn install --no-immutable && git add yarn.lock", "version": "yarn install --no-immutable && git add yarn.lock",
"postversion": "./scripts/push-tags-one-by-one.sh", "postversion": "./scripts/push-tags-one-by-one.sh",
"lerna:list": " yarn lerna list -all" "lerna:list": " yarn lerna list -all",
"upgrade:snjs": "ncu -u '@standardnotes/*' && yarn workspaces foreach --verbose run ncu -u '@standardnotes/*'"
}, },
"resolutions": { "resolutions": {
"@types/styled-components/@types/react": "17.0.2", "@types/styled-components/@types/react": "17.0.2",
@@ -38,6 +39,9 @@
"@types/react-native/@types/react": "17.0.2", "@types/react-native/@types/react": "17.0.2",
"@types/hoist-non-react-statics/@types/react": "17.0.2" "@types/hoist-non-react-statics/@types/react": "17.0.2"
}, },
"dependencies": {
"@standardnotes/snjs": "^2.117.4"
},
"devDependencies": { "devDependencies": {
"@commitlint/cli": "^17.0.2", "@commitlint/cli": "^17.0.2",
"@commitlint/config-conventional": "^17.0.2", "@commitlint/config-conventional": "^17.0.2",

View File

@@ -0,0 +1,8 @@
import { FeatureIdentifier } from '@standardnotes/features';
declare type ChecksumEntry = {
version: string;
base64: string;
binary: string;
};
export declare type ComponentChecksumsType = Record<FeatureIdentifier, ChecksumEntry>;
export {};

View File

@@ -8,5 +8,6 @@
"url": "http://localhost:3000/index.html", "url": "http://localhost:3000/index.html",
"download_url": "", "download_url": "",
"latest_url": "", "latest_url": "",
"marketing_url": "https://github.com/standardnotes/advanced-checklist",
"thumbnail_url": "" "thumbnail_url": ""
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

1
packages/components/dist/index.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
export * from './Types/Checksums';

View File

@@ -1,97 +1,97 @@
{ {
"org.standardnotes.theme-midnight": { "org.standardnotes.theme-midnight": {
"version": "1.2.8", "version": "1.2.9-alpha.1",
"base64": "fa09e6b27afe20f13049b259d20fa204d3910b96ae47402a3f9d523841b8e1b0", "base64": "6165b05c69843e0ed21470ec3d72fc68f5b6ef48c6442f385cd44f836cf7ce0c",
"binary": "46f507846ccd3980ae8a796f8788127b5d450365d1f141e5a1262435aa5cd651" "binary": "961a8216c80df28fbc795f3a53035eaea84e173559dfc8f260e4aad101e6908e"
}, },
"org.standardnotes.theme-futura": { "org.standardnotes.theme-futura": {
"version": "1.2.9", "version": "1.2.10-alpha.1",
"base64": "837a721c65be85dd1bedc2e2829d011cc0acca3085e8ce2dafca651365a44f1c", "base64": "e29d655eaf550a8c7ba618496ffe0accdca89f1c57720f8f08a8772779df9bfc",
"binary": "9e787646926864a80f5d84cbb04ee9a7840d84287ea79b1f1532ce2c44ea68c5" "binary": "109cd975990de5e9398a50c1870ecd21184a33f24e9c0e5d1f1a16891f21f025"
}, },
"org.standardnotes.theme-solarized-dark": { "org.standardnotes.theme-solarized-dark": {
"version": "1.2.7", "version": "1.2.8-alpha.1",
"base64": "a1a6ce0ea404cf41e35ccb27e33cc777d7fc1b4becca02d1d4ffd5640afce868", "base64": "a45eac36870bdcd439d0022d564d8ec326bd875883930703e178952f81550fec",
"binary": "c41b727a56d8a02025460e0bdcf4f3ea50c8a0572d59d049603fb68d92bc2a64" "binary": "953c39de9ed28f3f5313f7a5752408cc48656f0ed93ac64254a85ccd24ab3cf6"
}, },
"org.standardnotes.theme-autobiography": { "org.standardnotes.theme-autobiography": {
"version": "1.0.4", "version": "1.0.5-alpha.1",
"base64": "64ef874bdc345ccd9e51f0f58ce65a36ebb47eafa7ab1284fcf886dd0e6cb509", "base64": "2be6c6a0540961b1d8837acf47b30bde481ea5f15b8f66dd8dac9c6eb5c2cc7e",
"binary": "16fab2c527b2171f8d98ca691a1af6d0d2c07b57e9c946406e9902771f4d7037" "binary": "5271772c4a650b321c2542f38ae4fbfbc8a9df4219e191d70411e0e264f02b4c"
}, },
"org.standardnotes.theme-focus": { "org.standardnotes.theme-focus": {
"version": "1.2.9", "version": "1.2.10-alpha.1",
"base64": "107a604886b85087b22540b3a36d15ace6c1598d33ed1f0ebdc79c1032cc77ee", "base64": "87b4d74d6bff308d5ac4191a437c5286f7881f5de0cfa83693b5aef395f7b3cf",
"binary": "a40d75e1cc8a1ed363714ba4ba4d9400528cbd1da2b1039b78a0ec8ce289ef76" "binary": "fd3237cf9e372801b27adfcd73a7dc79f445f024ddb4b78a4fc3ddb3189e4dec"
}, },
"org.standardnotes.theme-titanium": { "org.standardnotes.theme-titanium": {
"version": "1.2.7", "version": "1.2.9-alpha.1",
"base64": "b4553f9e8698b852c5f0a31016f50e421fab059a42df1983a574a3031892ebd6", "base64": "b40a620e7b785b3eaa35b00dd6da15ba86a2443680b81cb0884fc9a032672d4c",
"binary": "a3e9a46aaac10d961a9927a723c8af913b100a46a7bb3945f0efb6b515856899" "binary": "e49202eeedfb2ceda803115ec924240a668aed24f7e49e8b134993df17a2cd4f"
}, },
"org.standardnotes.theme-dynamic": { "org.standardnotes.theme-dynamic": {
"version": "1.0.4", "version": "1.0.5-alpha.1",
"base64": "e3eba3e9c17517602ff3973458e0c6ef3c81510250ecef5c3dcafb60363340e3", "base64": "8609f088d3b07f38c3deaf29ff1399d7bcb1d7dd6dcf4ce0df5f788fc990f813",
"binary": "55cfa812745e9096a8c8d146bfc6bd905581139086a39ffff6b2674f4585c9b8" "binary": "368343ea9f710ed65e002805edaa74e336a1f891455234b8b26915c1f3ef0ee2"
}, },
"org.standardnotes.code-editor": { "org.standardnotes.code-editor": {
"version": "1.3.12", "version": "1.3.13-alpha.1",
"base64": "d777b5f39e5430714b9583799cc0dcf69ade72f180b1f992a7f4389f10f9b683", "base64": "cc305850a5762a4e31b4207b4fcb7ecda0b4955d412e71b34b23e258bf3af6d5",
"binary": "887e86e9a4a633745541bb3ad3d35bb25c8741fee9c45c8d0b5b177345103a75" "binary": "8b84785419dc2fdc06b75c13126c707aff12c9a3cacdfba4621d2c69cec098f8"
}, },
"org.standardnotes.bold-editor": { "org.standardnotes.bold-editor": {
"version": "1.3.5", "version": "1.3.6-alpha.1",
"base64": "a3224564533c6f4ca4bb1df9c37b9f122a33e4fc102d74b872dd781c32c79607", "base64": "1e28060736f980b15d5334ae66d963df71a138a87217475ff4fbed194e434aa7",
"binary": "a3c29d6938b404db11e6523f6f54a607fff42b316f0962ee46b00cc01f5d2152" "binary": "1a53619e931032a8d0a9d33be1ba0bd4cf2414ed96691568bda40e14fb87e7bb"
}, },
"org.standardnotes.plus-editor": { "org.standardnotes.plus-editor": {
"version": "1.6.1", "version": "1.6.2-alpha.1",
"base64": "52b0e8b7ad151fa6a3b16ff8df17c60450861c7ff28de8af2466b137bb2d98e4", "base64": "608945589195726ca1b61296776d70bc77d404d50fc3df2288984f40fb97418b",
"binary": "9b21e29db0af8a66a1f45e41440ea1890f07ea145329074b4cfd44991b6fda45" "binary": "935b63240e2fb30b5b873c991c193a719014238b8cda161b3107e6e062ba3564"
}, },
"org.standardnotes.simple-markdown-editor": { "org.standardnotes.simple-markdown-editor": {
"version": "1.4.2", "version": "1.4.3-alpha.1",
"base64": "b5c8c39eda1a7b8696338bf9a1def3825a0b4d52860c160c1fd34bbe436a5acc", "base64": "1166bd3cbfa8abea0ac406b29eff717fecb8df46ef39e7b6a590349da906b220",
"binary": "2068101123cecf74943f8d5acf59d888f2b339082b2acd4c1112bde4f92a8946" "binary": "d760dd41ec3370e2f1b4e6f7dc06660d230fa441a5ce58181f807b13af238958"
}, },
"org.standardnotes.advanced-markdown-editor": { "org.standardnotes.advanced-markdown-editor": {
"version": "1.5.0", "version": "1.5.1-alpha.1",
"base64": "93f0efd8163a92b191c235703fde5b48b6fc858d47864db77e33e8ca6b985810", "base64": "f86a561f8b2cde9717c019b4d3b2d7594e72896c2ac2dc950c263f01bb545e97",
"binary": "c5052a25f33f1bf80fd5f1ee848550ce3818f5095c6ee370e7bfb9dd49c12231" "binary": "2a0d30f0b1a337f1a3374478c4a89595d1d06f37ab399b0c9297ef60db476b30"
}, },
"org.standardnotes.minimal-markdown-editor": { "org.standardnotes.minimal-markdown-editor": {
"version": "1.3.9", "version": "1.3.10-alpha.1",
"base64": "9d4894e1e0b57fe5421fcc6c3b080f675d2c7690d0f4404b58b21673f3a89cd1", "base64": "f22c0f8a7bb2f0d7ef3bc3cd0e13aec3bc6761c930f6d0fadc09b4241923ebfe",
"binary": "8e11325526f297eaea81d3f0c2a0d837e17e2f7899a18b5717a415f674da907b" "binary": "53a508637e869bb494310fa8e5ed93acc2e94b09ae723ee491b4d192a43c2067"
}, },
"org.standardnotes.fancy-markdown-editor": { "org.standardnotes.fancy-markdown-editor": {
"version": "1.3.6", "version": "1.3.7-alpha.1",
"base64": "a4bf2b64da0d9a95f71bb7cbfd50ce2f96c83602e95c7beab64386900697d76c", "base64": "2683cb1a029c478970af3fcffe7fd0c32532690285011e873fb87db4cc2bbe2f",
"binary": "1fc09232051a50f77a47d8faecfe6166d9bbd812d7704f87b985d740b5225e0a" "binary": "53200813addb0da6efb271af36afd5f315053862522d41949ef9db64d4f12800"
}, },
"org.standardnotes.markdown-visual-editor": { "org.standardnotes.markdown-visual-editor": {
"version": "1.0.7", "version": "1.0.8-alpha.1",
"base64": "3ce8ea96cbfa706e5a0c722aee7a37a46c8e966e6a047c37056c888e78641182", "base64": "38639b2688305846a1e5ceb20bae163072b8a551b9a0ae0eaa582327450daa4f",
"binary": "2468f1d63e996cf75fa4e914d4cbee56cf9cfc1333da8f760350a353347889c6" "binary": "29c1f203206f539583ebd11c17e04a821c83cd1b00cac0039bf20f3de5792e8d"
}, },
"org.standardnotes.simple-task-editor": { "org.standardnotes.simple-task-editor": {
"version": "1.3.10", "version": "1.3.11-alpha.1",
"base64": "60aaca870a2fcbfbdb3287251ba4557c6d53f168189e4e177faf2bf7b48b668b", "base64": "a9ce7e200ba8a929ad038021f8484ff87c79b262befcc3b99212aee701714447",
"binary": "716762ee873e7bd47914ddd4c01189e509a58661bf6a7c61f2fd518d6e453881" "binary": "7f610bdd413d3efdbcfc6ea88e729c7cc9c3169334b5bc971434ee61f56c3256"
}, },
"org.standardnotes.token-vault": { "org.standardnotes.token-vault": {
"version": "2.0.10", "version": "2.0.11-alpha.1",
"base64": "3db39101407bb0aad21d3e02f426989662859ab1b6b51e7060d3d54713423228", "base64": "fe02aed144e18148e1815badd39fdfeae1479ad88bd731701fc09c702907485e",
"binary": "fd8306b1869c39b08e8f7355223e224df6ecc2877e651956a10a77bb50613087" "binary": "b9d3c32f20928fbcb917d7d5030b382c5841980cc58ea5b0d500f4aaca538008"
}, },
"org.standardnotes.standard-sheets": { "org.standardnotes.standard-sheets": {
"version": "1.4.4", "version": "1.4.5-alpha.1",
"base64": "c5934810586596b30d6003c01a7caef6782c7afb2566a0630bc359973dc78131", "base64": "751c07efccb0134a1ebbba0bb8723a0cee244cdd11c0b03d0cc5d17a2fe405e5",
"binary": "92c81d3647ed78c59f8b14cc1e0b6c2d3e3fc48955d999b6120bdd114e720742" "binary": "35280f3623692b6bb67260178b115ea5d8d06c65127e14b22075f8c824b79367"
}, },
"org.standardnotes.advanced-checklist": { "org.standardnotes.advanced-checklist": {
"version": "0.0.1", "version": "0.0.2-alpha.1",
"base64": "152f20cf215da04df73c93dec516aeb2fff497bcb8f9247bbe5b5b4eeee70ea8", "base64": "9a9552e7d53ed20fd971ae41ba86accb5ac41732acfcfedb1713f3dcb95b104d",
"binary": "fe9566931698a47a67039e38a6d9a4f157a0221479d29684d48b2e9e5403e4f5" "binary": "494ebfb2544b3d28b40f95e18ba54d9042130eb29058c6b799d8e879a384c6d1"
} }
} }

View File

@@ -6,10 +6,11 @@
"main": "dist", "main": "dist",
"workspaces": { "workspaces": {
"packages": [ "packages": [
"src/*" "src/packages/*"
] ]
}, },
"scripts": { "scripts": {
"build": "tsc --project tsconfig.json",
"components:clean": "yarn workspaces foreach --parallel --jobs 10 --verbose --exclude @standardnotes/components-meta run components:clean", "components:clean": "yarn workspaces foreach --parallel --jobs 10 --verbose --exclude @standardnotes/components-meta run components:clean",
"components:lint": "yarn workspaces foreach --parallel --jobs 10 --verbose --exclude @standardnotes/components-meta run components:lint", "components:lint": "yarn workspaces foreach --parallel --jobs 10 --verbose --exclude @standardnotes/components-meta run components:lint",
"components:test": "yarn workspaces foreach --parallel --jobs 10 --verbose --exclude @standardnotes/components-meta run components:test", "components:test": "yarn workspaces foreach --parallel --jobs 10 --verbose --exclude @standardnotes/components-meta run components:test",
@@ -24,7 +25,8 @@
"minimatch": "^5.1.0", "minimatch": "^5.1.0",
"node-sass": "7.0.1", "node-sass": "7.0.1",
"sass": "^1.52.3", "sass": "^1.52.3",
"webpack": "^5.73.0", "typescript": "*",
"webpack": "*",
"webpack-remove-empty-scripts": "^0.8.0" "webpack-remove-empty-scripts": "^0.8.0"
} }
} }

View File

@@ -18,7 +18,7 @@ if (specificFeatureIdentifier) {
console.log('Processing only', specificFeatureIdentifier) console.log('Processing only', specificFeatureIdentifier)
} }
const SourceFilesPath = path.join(__dirname, '../src') const SourceFilesPath = path.join(__dirname, '../src/packages')
const DistDir = path.join(__dirname, '../dist') const DistDir = path.join(__dirname, '../dist')
const TmpDir = path.join(__dirname, '../tmp') const TmpDir = path.join(__dirname, '../tmp')
const ZipsDir = path.join(DistDir, '/zips') const ZipsDir = path.join(DistDir, '/zips')
@@ -82,8 +82,12 @@ const emptyExistingDir = (dir) => {
} }
} }
const getComponentSrcPath = (feature) => {
return path.join(SourceFilesPath, feature.identifier)
}
const copyComponentAssets = async (feature, destination, exludedFilesGlob) => { const copyComponentAssets = async (feature, destination, exludedFilesGlob) => {
const srcComponentPath = path.join(SourceFilesPath, feature.identifier) const srcComponentPath = getComponentSrcPath(feature)
if (!doesDirExist(srcComponentPath)) { if (!doesDirExist(srcComponentPath)) {
return false return false
@@ -124,19 +128,24 @@ const zipAndChecksumFeature = async (feature) => {
const assetsLocation = `${path.join(AssetsDir, feature.identifier)}` const assetsLocation = `${path.join(AssetsDir, feature.identifier)}`
const assetsSuccess = await copyComponentAssets(feature, assetsLocation, '**/package.json') const assetsSuccess = await copyComponentAssets(feature, assetsLocation, '**/package.json')
if (!assetsSuccess) { if (!assetsSuccess) {
console.log('Failed to copy assets for', feature.identifier)
return return
} }
const zipAssetsTmpLocation = `${path.join(TmpDir, feature.identifier)}` const zipAssetsTmpLocation = `${path.join(TmpDir, feature.identifier)}`
const zipAssetsSuccess = await copyComponentAssets(feature, zipAssetsTmpLocation) const zipAssetsSuccess = await copyComponentAssets(feature, zipAssetsTmpLocation)
if (!zipAssetsSuccess) { if (!zipAssetsSuccess) {
console.log('Failed to copy zip assets for', feature.identifier)
return return
} }
const zipDestination = `${ZipsDir}/${feature.identifier}.zip` const zipDestination = `${ZipsDir}/${feature.identifier}.zip`
await zipDirectory(zipAssetsTmpLocation, zipDestination) await zipDirectory(zipAssetsTmpLocation, zipDestination)
const checksum = await computeChecksum(zipDestination, feature.version) const packageJsonFilePath = path.join(getComponentSrcPath(feature), 'package.json')
const packageJsonFile = JSON.parse(fs.readFileSync(packageJsonFilePath).toString())
const checksum = await computeChecksum(zipDestination, packageJsonFile.version)
Checksums[feature.identifier] = checksum Checksums[feature.identifier] = checksum
console.log(`Computed checksums for ${feature.identifier}:`, checksum) console.log(`Computed checksums for ${feature.identifier}:`, checksum)
@@ -153,10 +162,10 @@ await (async () => {
console.log('\n---\n') console.log('\n---\n')
} }
if (feature.download_url) { if (['SN|Component', 'SN|Theme'].includes(feature.content_type)) {
await zipAndChecksumFeature(feature) await zipAndChecksumFeature(feature)
} else { } else {
console.log('Feature does not have download_url, not packaging', feature.identifier) console.log('Feature is not component, not packaging', feature.identifier)
} }
if (index !== featuresToProcess.length - 1) { if (index !== featuresToProcess.length - 1) {

View File

@@ -0,0 +1,9 @@
import { FeatureIdentifier } from '@standardnotes/features'
type ChecksumEntry = {
version: string
base64: string
binary: string
}
export type ComponentChecksumsType = Record<FeatureIdentifier, ChecksumEntry>

View File

@@ -0,0 +1 @@
export * from './Types/Checksums'

View File

@@ -1,2 +0,0 @@
const override = require('../../cra-app.override')
module.exports = override

View File

@@ -1,2 +0,0 @@
const override = require('../../cra-app.override')
module.exports = override

View File

@@ -0,0 +1,2 @@
const override = require('../cra-app.override')
module.exports = override

Some files were not shown because too many files have changed in this diff Show More