feat(wip): components monorepo (#1082)
This commit is contained in:
7
packages/components/dist/Checksums.json
vendored
Normal file
7
packages/components/dist/Checksums.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"org.standardnotes.theme-autobiography": {
|
||||
"version": "1.0.4",
|
||||
"base64": "b1df118550bca4ef10b6f8eaeeeddb051cde8171212c5a73a577c834d331725f",
|
||||
"binary": "8cf9b21daea61b41bde70bfd6a7a4fcb1a8cf5539da52a7f7bcd48f2faa1c748"
|
||||
}
|
||||
}
|
||||
51
packages/components/dist/org.standardnotes.theme-autobiography/dist/dist.css
vendored
Normal file
51
packages/components/dist/org.standardnotes.theme-autobiography/dist/dist.css
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
:root {
|
||||
--background-1: #EDE4DA;
|
||||
--background-2: #e8d9c8;
|
||||
--foreground-color: #5C3F27;
|
||||
--border-color: #d9c6b1;
|
||||
--highlight-color: #D68420;
|
||||
--highlight-contrast: #e3ae74;
|
||||
--sn-stylekit-info-color: #a37337;
|
||||
--sn-stylekit-info-contrast-color: #ebcdaa;
|
||||
--sn-stylekit-neutral-color: #a47c5b;
|
||||
--sn-stylekit-neutral-contrast-color: #e7ddd2;
|
||||
--sn-stylekit-success-color: #9f4e03;
|
||||
--sn-stylekit-success-contrast-color: #ebcdaa;
|
||||
--sn-stylekit-warning-color: #b87a02;
|
||||
--sn-stylekit-warning-contrast-color: #ebcdaa;
|
||||
--sn-stylekit-danger-color: #a71428;
|
||||
--sn-stylekit-danger-contrast-color: #ebcdaa;
|
||||
--sn-stylekit-shadow-color: var(--background-2);
|
||||
--sn-stylekit-background-color: var(--background-1);
|
||||
--sn-stylekit-foreground-color: var(--foreground-color);
|
||||
--sn-stylekit-border-color: var(--border-color);
|
||||
--sn-stylekit-paragraph-text-color: var(--foreground-color);
|
||||
--sn-stylekit-contrast-background-color: var(--background-2);
|
||||
--sn-stylekit-contrast-foreground-color: var(--foreground-color);
|
||||
--sn-stylekit-contrast-border-color: var(--border-color);
|
||||
--sn-stylekit-secondary-background-color: var(--background-1);
|
||||
--sn-stylekit-secondary-foreground-color: var(--foreground-color);
|
||||
--sn-stylekit-secondary-border-color: var(--border-color);
|
||||
--sn-stylekit-secondary-contrast-background-color: var(--background-2);
|
||||
--sn-stylekit-secondary-contrast-foreground-color: var(--foreground-color);
|
||||
--sn-stylekit-secondary-contrast-border-color: var(--border-color);
|
||||
--sn-stylekit-editor-background-color: var(--sn-stylekit-background-color);
|
||||
--sn-stylekit-editor-foreground-color: var(--sn-stylekit-foreground-color);
|
||||
--sn-stylekit-scrollbar-track-border-color: var(--border-color);
|
||||
--sn-stylekit-scrollbar-thumb-color: var(--sn-stylekit-info-color);
|
||||
--sn-desktop-titlebar-bg-color: var(--background-1);
|
||||
--sn-desktop-titlebar-border-color: var(--border-color);
|
||||
--sn-desktop-titlebar-ui-color: var(--foreground-color);
|
||||
--sn-desktop-titlebar-ui-hover-color: var(--highlight-color);
|
||||
--sn-stylekit-passive-color-0: #7e582a;
|
||||
--sn-stylekit-passive-color-1: #a37337;
|
||||
--sn-stylekit-passive-color-4-opacity-variant: #c9995e3d;
|
||||
--sn-stylekit-passive-color-5: #e9d9c7;
|
||||
}
|
||||
|
||||
#notes-column .note.selected, .notes .note.selected {
|
||||
background-color: #e9d9c7;
|
||||
color: var(--sn-stylekit-contrast-foreground-color);
|
||||
}
|
||||
|
||||
/*# sourceMappingURL=dist.css.map */
|
||||
7
packages/components/dist/org.standardnotes.theme-autobiography/dist/dist.css.map
vendored
Normal file
7
packages/components/dist/org.standardnotes.theme-autobiography/dist/dist.css.map
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"version": 3,
|
||||
"mappings": "AAAA,KAAM;EACJ,cAAc,CAAC,QAAQ;EACvB,cAAc,CAAC,QAAQ;EACvB,kBAAkB,CAAC,QAAQ;EAC3B,cAAc,CAAC,QAAQ;EACvB,iBAAiB,CAAC,QAAQ;EAC1B,oBAAoB,CAAC,QAAQ;EAE7B,wBAAwB,CAAC,QAAQ;EACjC,iCAAiC,CAAC,QAAQ;EAE1C,2BAA2B,CAAC,QAAQ;EACpC,oCAAoC,CAAC,QAAQ;EAE7C,2BAA2B,CAAC,QAAQ;EACpC,oCAAoC,CAAC,QAAQ;EAE7C,2BAA2B,CAAC,QAAQ;EACpC,oCAAoC,CAAC,QAAQ;EAE7C,0BAA0B,CAAC,QAAQ;EACnC,mCAAmC,CAAC,QAAQ;EAE5C,0BAA0B,CAAC,oBAAoB;EAE/C,8BAA8B,CAAC,oBAAoB;EACnD,8BAA8B,CAAC,wBAAwB;EACvD,0BAA0B,CAAC,oBAAoB;EAE/C,kCAAkC,CAAC,wBAAwB;EAE3D,uCAAuC,CAAC,oBAAoB;EAC5D,uCAAuC,CAAC,wBAAwB;EAChE,mCAAmC,CAAC,oBAAoB;EAExD,wCAAwC,CAAC,oBAAoB;EAC7D,wCAAwC,CAAC,wBAAwB;EACjE,oCAAoC,CAAC,oBAAoB;EAEzD,iDAAiD,CAAC,oBAAoB;EACtE,iDAAiD,CAAC,wBAAwB;EAC1E,6CAA6C,CAAC,oBAAoB;EAElE,qCAAqC,CAAC,oCAAoC;EAC1E,qCAAqC,CAAC,oCAAoC;EAE1E,0CAA0C,CAAC,oBAAoB;EAC/D,mCAAmC,CAAC,8BAA8B;EAElE,8BAA8B,CAAC,oBAAoB;EACnD,kCAAkC,CAAC,oBAAoB;EACvD,8BAA8B,CAAC,wBAAwB;EACvD,oCAAoC,CAAC,uBAAuB;EAE5D,6BAA6B,CAAC,QAAQ;EACtC,6BAA6B,CAAC,QAAQ;EACtC,6CAA6C,CAAC,UAAU;EACxD,6BAA6B,CAAC,QAAQ;;;AAGxC,mDAAoD;EAClD,gBAAgB,EAAE,OAAO;EACzB,KAAK,EAAE,4CAA4C",
|
||||
"sources": ["../src/main.scss"],
|
||||
"names": [],
|
||||
"file": "dist.css"
|
||||
}
|
||||
Binary file not shown.
26
packages/components/dist/org.standardnotes.theme-autobiography/package.json
vendored
Normal file
26
packages/components/dist/org.standardnotes.theme-autobiography/package.json
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "@standardnotes/autobiography-theme",
|
||||
"version": "1.0.4",
|
||||
"main": "dist/dist.css",
|
||||
"devDependencies": {
|
||||
"grunt": "^1.0.1",
|
||||
"grunt-contrib-sass": "^1.0.0",
|
||||
"grunt-contrib-watch": "^1.0.0",
|
||||
"grunt-newer": "^1.2.0"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "grunt",
|
||||
"prepublishOnly": "yarn run build"
|
||||
},
|
||||
"sn": {
|
||||
"main": "dist/dist.css"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/standardnotes/autobiography-theme.git"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public",
|
||||
"registry": "https://registry.npmjs.org/"
|
||||
}
|
||||
}
|
||||
4
packages/components/lerna.json
Normal file
4
packages/components/lerna.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"packages": ["src/*"],
|
||||
"useWorkspaces": true
|
||||
}
|
||||
22
packages/components/package.json
Normal file
22
packages/components/package.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "@standardnotes/components-meta",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"workspaces": {
|
||||
"packages": [
|
||||
"src/*"
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"preversion": "lerna run build --parallel",
|
||||
"version": "node scripts/package-components.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"@standardnotes/autobiography-theme": "1.0.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@standardnotes/deterministic-zip": "^1.2.0",
|
||||
"@standardnotes/features": "^1.45.1",
|
||||
"lerna": "*"
|
||||
}
|
||||
}
|
||||
149
packages/components/scripts/package-components.mjs
Normal file
149
packages/components/scripts/package-components.mjs
Normal file
@@ -0,0 +1,149 @@
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
import crypto from 'crypto'
|
||||
import { spawnSync as spawn } from 'child_process'
|
||||
import { GetFeatures } from '@standardnotes/features/dist/Domain/Feature/Features.js'
|
||||
import { GetDeprecatedFeatures } from '@standardnotes/features/dist/Domain/Feature/Lists/DeprecatedFeatures.js'
|
||||
import zip from '@standardnotes/deterministic-zip'
|
||||
|
||||
console.log('Beginning packaging procedure...')
|
||||
|
||||
const specificFeatureIdentifier = process.argv[2]
|
||||
if (specificFeatureIdentifier) {
|
||||
console.log('Processing only', specificFeatureIdentifier)
|
||||
}
|
||||
|
||||
const SOURCE_FILES_PATH = 'src'
|
||||
const DistDir = path.join('dist')
|
||||
|
||||
const ChecksumsSrcPath = path.join(DistDir, 'Checksums.json')
|
||||
const ChecksumsDistPath = path.join(DistDir, 'Checksums.json')
|
||||
const Checksums = JSON.parse(fs.readFileSync(ChecksumsSrcPath).toString())
|
||||
console.log('Loaded existing checksums from', ChecksumsSrcPath)
|
||||
|
||||
async function zipDirectory(sourceDir, outPath) {
|
||||
return new Promise((resolve) => {
|
||||
zip(sourceDir, outPath, { cwd: sourceDir }, (err) => {
|
||||
console.log(`Zipped to ${outPath}`)
|
||||
resolve(outPath)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
const copyFileOrDir = (src, dest) => {
|
||||
const isDir = fs.lstatSync(src).isDirectory()
|
||||
if (isDir) {
|
||||
ensureDirExists(dest)
|
||||
const entries = fs.readdirSync(src, { withFileTypes: true })
|
||||
|
||||
for (const entry of entries) {
|
||||
const srcPath = path.join(src, entry.name)
|
||||
const destPath = path.join(dest, entry.name)
|
||||
|
||||
entry.isDirectory() ? copyFileOrDir(srcPath, destPath) : fs.copyFileSync(srcPath, destPath)
|
||||
}
|
||||
} else {
|
||||
fs.copyFileSync(src, dest)
|
||||
}
|
||||
}
|
||||
|
||||
const doesDirExist = (dir) => {
|
||||
return fs.existsSync(dir)
|
||||
}
|
||||
|
||||
const ensureDirExists = (dir) => {
|
||||
if (!fs.existsSync(dir)) {
|
||||
fs.mkdirSync(dir, { recursive: true })
|
||||
}
|
||||
}
|
||||
|
||||
const emptyExistingDir = (dir) => {
|
||||
if (fs.existsSync(dir)) {
|
||||
fs.rmSync(dir, { recursive: true })
|
||||
}
|
||||
}
|
||||
|
||||
const copyToDist = async (feature) => {
|
||||
const srcComponentPath = path.join(SOURCE_FILES_PATH, feature.identifier)
|
||||
|
||||
if (!doesDirExist(srcComponentPath)) {
|
||||
return
|
||||
}
|
||||
|
||||
const targetComponentPath = `${path.join(DistDir, feature.identifier)}`
|
||||
|
||||
emptyExistingDir(targetComponentPath)
|
||||
ensureDirExists(targetComponentPath)
|
||||
|
||||
for (const file of feature.static_files) {
|
||||
const srcFilePath = path.join(srcComponentPath, file)
|
||||
|
||||
if (!fs.existsSync(srcFilePath)) {
|
||||
continue
|
||||
}
|
||||
|
||||
const targetFilePath = path.join(targetComponentPath, file)
|
||||
copyFileOrDir(srcFilePath, targetFilePath)
|
||||
}
|
||||
|
||||
return targetComponentPath
|
||||
}
|
||||
|
||||
const computeChecksum = async (zipPath, version) => {
|
||||
const zipData = fs.readFileSync(zipPath, 'base64')
|
||||
const base64 = crypto.createHash('sha256').update(zipData).digest('hex')
|
||||
const checksumProcess = spawn('sha256sum', [zipPath])
|
||||
const checksumString = checksumProcess.stdout.toString()
|
||||
const binary = checksumString.split(' ')[0]
|
||||
return {
|
||||
version,
|
||||
base64,
|
||||
binary,
|
||||
}
|
||||
}
|
||||
|
||||
const zipAndChecksumFeature = async (feature) => {
|
||||
console.log('Processing feature', feature.identifier, '...')
|
||||
|
||||
const distPath = await copyToDist(feature)
|
||||
|
||||
if (!distPath) {
|
||||
return
|
||||
}
|
||||
|
||||
const outZip = `${distPath}/${feature.identifier}.zip`
|
||||
await zipDirectory(distPath, outZip)
|
||||
|
||||
const checksum = await computeChecksum(outZip, feature.version)
|
||||
Checksums[feature.identifier] = checksum
|
||||
console.log(`Computed checksums for ${feature.identifier}:`, checksum)
|
||||
}
|
||||
|
||||
await (async () => {
|
||||
const featuresToProcess = specificFeatureIdentifier
|
||||
? [GetFeatures().find((feature) => feature.identifier === specificFeatureIdentifier)]
|
||||
: GetFeatures().concat(GetDeprecatedFeatures())
|
||||
|
||||
let index = 0
|
||||
for (const feature of featuresToProcess) {
|
||||
if (index === 0) {
|
||||
console.log('\n---\n')
|
||||
}
|
||||
|
||||
if (feature.download_url) {
|
||||
await zipAndChecksumFeature(feature)
|
||||
} else {
|
||||
console.log('Feature does not have download_url, not packaging', feature.identifier)
|
||||
}
|
||||
|
||||
if (index !== featuresToProcess.length - 1) {
|
||||
console.log('\n---\n')
|
||||
}
|
||||
|
||||
index++
|
||||
}
|
||||
|
||||
fs.writeFileSync(ChecksumsSrcPath, JSON.stringify(Checksums, undefined, 2))
|
||||
console.log('Succesfully wrote checksums to', ChecksumsSrcPath)
|
||||
copyFileOrDir(ChecksumsSrcPath, ChecksumsDistPath)
|
||||
})()
|
||||
1
packages/components/src/org.standardnotes.theme-autobiography/.gitignore
vendored
Normal file
1
packages/components/src/org.standardnotes.theme-autobiography/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
dist
|
||||
@@ -0,0 +1,31 @@
|
||||
module.exports = function(grunt) {
|
||||
|
||||
grunt.initConfig({
|
||||
watch: {
|
||||
css: {
|
||||
files: ['src/**/*.scss'],
|
||||
tasks: ['sass'],
|
||||
options: {
|
||||
spawn: false,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
sass: {
|
||||
dist: {
|
||||
options: {
|
||||
style: 'expanded'
|
||||
},
|
||||
files: {
|
||||
'dist/dist.css': 'src/main.scss'
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
grunt.loadNpmTasks('grunt-newer');
|
||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||
grunt.loadNpmTasks('grunt-contrib-sass');
|
||||
|
||||
grunt.registerTask('default', ['sass']);
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
# Autobiography Theme
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "@standardnotes/autobiography-theme",
|
||||
"version": "1.0.4",
|
||||
"main": "dist/dist.css",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"build": "grunt",
|
||||
"prepublishOnly": "yarn run build"
|
||||
},
|
||||
"sn": {
|
||||
"main": "dist/dist.css"
|
||||
},
|
||||
"devDependencies": {
|
||||
"grunt": "^1.0.1",
|
||||
"grunt-contrib-sass": "^1.0.0",
|
||||
"grunt-contrib-watch": "^1.0.0",
|
||||
"grunt-newer": "^1.2.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
:root {
|
||||
--background-1: #EDE4DA;
|
||||
--background-2: #e8d9c8;
|
||||
--foreground-color: #5C3F27;
|
||||
--border-color: #d9c6b1;
|
||||
--highlight-color: #D68420;
|
||||
--highlight-contrast: #e3ae74;
|
||||
|
||||
--sn-stylekit-info-color: #a37337;
|
||||
--sn-stylekit-info-contrast-color: #ebcdaa;
|
||||
|
||||
--sn-stylekit-neutral-color: #a47c5b;
|
||||
--sn-stylekit-neutral-contrast-color: #e7ddd2;
|
||||
|
||||
--sn-stylekit-success-color: #9f4e03;
|
||||
--sn-stylekit-success-contrast-color: #ebcdaa;
|
||||
|
||||
--sn-stylekit-warning-color: #b87a02;
|
||||
--sn-stylekit-warning-contrast-color: #ebcdaa;
|
||||
|
||||
--sn-stylekit-danger-color: #a71428;
|
||||
--sn-stylekit-danger-contrast-color: #ebcdaa;
|
||||
|
||||
--sn-stylekit-shadow-color: var(--background-2);
|
||||
|
||||
--sn-stylekit-background-color: var(--background-1);
|
||||
--sn-stylekit-foreground-color: var(--foreground-color);
|
||||
--sn-stylekit-border-color: var(--border-color);
|
||||
|
||||
--sn-stylekit-paragraph-text-color: var(--foreground-color);
|
||||
|
||||
--sn-stylekit-contrast-background-color: var(--background-2);
|
||||
--sn-stylekit-contrast-foreground-color: var(--foreground-color);
|
||||
--sn-stylekit-contrast-border-color: var(--border-color);
|
||||
|
||||
--sn-stylekit-secondary-background-color: var(--background-1);
|
||||
--sn-stylekit-secondary-foreground-color: var(--foreground-color);
|
||||
--sn-stylekit-secondary-border-color: var(--border-color);
|
||||
|
||||
--sn-stylekit-secondary-contrast-background-color: var(--background-2);
|
||||
--sn-stylekit-secondary-contrast-foreground-color: var(--foreground-color);
|
||||
--sn-stylekit-secondary-contrast-border-color: var(--border-color);
|
||||
|
||||
--sn-stylekit-editor-background-color: var(--sn-stylekit-background-color);
|
||||
--sn-stylekit-editor-foreground-color: var(--sn-stylekit-foreground-color);
|
||||
|
||||
--sn-stylekit-scrollbar-track-border-color: var(--border-color);
|
||||
--sn-stylekit-scrollbar-thumb-color: var(--sn-stylekit-info-color);
|
||||
|
||||
--sn-desktop-titlebar-bg-color: var(--background-1);
|
||||
--sn-desktop-titlebar-border-color: var(--border-color);
|
||||
--sn-desktop-titlebar-ui-color: var(--foreground-color);
|
||||
--sn-desktop-titlebar-ui-hover-color: var(--highlight-color);
|
||||
|
||||
--sn-stylekit-passive-color-0: #7e582a;
|
||||
--sn-stylekit-passive-color-1: #a37337;
|
||||
--sn-stylekit-passive-color-4-opacity-variant: #c9995e3d;
|
||||
--sn-stylekit-passive-color-5: #e9d9c7;
|
||||
}
|
||||
|
||||
#notes-column .note.selected, .notes .note.selected {
|
||||
background-color: #e9d9c7;
|
||||
color: var(--sn-stylekit-contrast-foreground-color);
|
||||
}
|
||||
Reference in New Issue
Block a user