Skip to content

Commit 05eb6e5

Browse files
committed
feat: build process and ci for web-client
1 parent 547d671 commit 05eb6e5

File tree

7 files changed

+305
-16
lines changed

7 files changed

+305
-16
lines changed

.clean-publish

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"withoutPublish": true,
3+
"tempDir": "package"
4+
}

.drone.star

+10-2
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,11 @@ def beforePipelines(ctx):
297297

298298
def stagePipelines(ctx):
299299
unit_test_pipelines = unitTests(ctx)
300+
301+
# only run unit tests when publishing a standalone package
302+
if (determineReleasePackage(ctx) != None):
303+
return [] # FIXME: quick iteration, comment in before merge: unit_test_pipelines
304+
300305
e2e_pipelines = e2eTests(ctx)
301306
acceptance_pipelines = acceptance(ctx)
302307
keycloak_pipelines = e2eTestsOnKeycloak(ctx)
@@ -1078,6 +1083,7 @@ def buildRelease(ctx):
10781083
},
10791084
]
10801085
else:
1086+
full_package_name = "%s/%s" % (WEB_PUBLISH_NPM_ORGANIZATION, package)
10811087
steps.append(
10821088
{
10831089
"name": "publish",
@@ -1088,15 +1094,17 @@ def buildRelease(ctx):
10881094
},
10891095
},
10901096
"commands": [
1091-
"echo " + package + " " + version,
1097+
"echo Build " + package + " " + version + " package.json: $(jq -r '.version' < packages/%s/package.json)" % package,
10921098
"[ \"$(jq -r '.version' < packages/%s/package.json)\" = \"%s\" ] || (echo \"git tag does not match version in packages/%s/package.json\"; exit 1)" % (package, version, package),
10931099
"git checkout .",
10941100
"git clean -fd",
10951101
"git diff",
10961102
"git status",
1103+
"pnpm build:tokens",
1104+
"bash -c '[ \"%s\" == \"web-client\" ] && pnpm --filter \"%s\" vite build || true'" % (package, full_package_name),
10971105
# until https://github.com/pnpm/pnpm/issues/5775 is resolved, we print pnpm whoami because that fails when the npm_token is invalid
10981106
"env \"npm_config_//registry.npmjs.org/:_authToken=$${NPM_TOKEN}\" pnpm whoami",
1099-
"env \"npm_config_//registry.npmjs.org/:_authToken=$${NPM_TOKEN}\" pnpm publish --no-git-checks --filter %s --access public --tag latest" % ("%s/%s" % (WEB_PUBLISH_NPM_ORGANIZATION, package)),
1107+
"env \"npm_config_//registry.npmjs.org/:_authToken=$${NPM_TOKEN}\" pnpm publish --no-git-checks --filter %s --access public --tag latest" % full_package_name,
11001108
],
11011109
"when": {
11021110
"ref": [

packages/web-client/package.json

+49-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,56 @@
11
{
22
"name": "@ownclouders/web-client",
3-
"version": "0.0.1",
3+
"version": "0.0.2",
44
"description": "ownCloud web client",
55
"license": "AGPL-3.0",
66
"private": false,
7+
"type": "module",
78
"author": "ownCloud GmbH <[email protected]>",
89
"homepage": "https://github.com/owncloud/web/tree/master/packages/web-client",
910
"repository": {
1011
"type": "git",
1112
"url": "https://github.com/owncloud/web",
1213
"directory": "packages/web-client"
1314
},
15+
"files": [
16+
"dist/"
17+
],
18+
"publishConfig": {
19+
"directory": "package",
20+
"linkDirectory": false,
21+
"exports": {
22+
".": {
23+
"default": "./dist/web-client.js",
24+
"require": "./dist/web-client.cjs",
25+
"types": "./dist/src/index.d.ts"
26+
},
27+
"./graph": {
28+
"default": "./dist/web-client/graph.js",
29+
"require": "./dist/web-client/graph.cjs",
30+
"types": "./dist/src/graph/index.d.ts"
31+
},
32+
"./graph/generated": {
33+
"default": "./dist/web-client/graph/generated.js",
34+
"require": "./dist/web-client/graph/generated.cjs",
35+
"types": "./dist/src/graph/generated/index.d.ts"
36+
},
37+
"./ocs": {
38+
"default": "./dist/web-client/ocs.js",
39+
"require": "./dist/web-client/ocs.cjs",
40+
"types": "./dist/src/ocs/index.d.ts"
41+
},
42+
"./sse": {
43+
"default": "./dist/web-client/sse.js",
44+
"require": "./dist/web-client/sse.cjs",
45+
"types": "./dist/src/sse/index.d.ts"
46+
},
47+
"./webdav": {
48+
"default": "./dist/web-client/webdav.js",
49+
"require": "./dist/web-client/webdav.cjs",
50+
"types": "./dist/src/webdav/index.d.ts"
51+
}
52+
}
53+
},
1454
"exports": {
1555
".": {
1656
"default": "./src/index.ts"
@@ -35,12 +75,18 @@
3575
}
3676
},
3777
"scripts": {
38-
"generate-openapi": "rm -rf src/generated && docker run --rm -v \"${PWD}/src:/local\" openapitools/openapi-generator-cli generate -i https://raw.githubusercontent.com/owncloud/libre-graph-api/main/api/openapi-spec/v1.0.yaml -g typescript-axios -o /local/generated"
78+
"generate-openapi": "rm -rf src/generated && docker run --rm -v \"${PWD}/src:/local\" openapitools/openapi-generator-cli generate -i https://raw.githubusercontent.com/owncloud/libre-graph-api/main/api/openapi-spec/v1.0.yaml -g typescript-axios -o /local/generated",
79+
"vite": "vite",
80+
"prepublishOnly": "rm -rf ./package && clean-publish && rm -rf package/dist/tests && find package && cat package/package.json",
81+
"postpublish": "rm -rf ./package"
82+
},
83+
"devDependencies": {
84+
"vite-plugin-dts": "3.6.0"
3985
},
4086
"peerDependencies": {
41-
"@ownclouders/web-client": "workspace:*",
4287
"@casl/ability": "^6.3.3",
4388
"axios": "1.6.8",
89+
"clean-publish": "4.2.0",
4490
"fast-xml-parser": "4.3.3",
4591
"lodash-es": "^4.17.21",
4692
"luxon": "3.2.1",

packages/web-client/src/webdav/client/dav.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ import { WebDavResponseResource } from '../../helpers'
1414
import { HttpError } from '../../errors'
1515
import { AxiosInstance } from 'axios'
1616

17-
interface DAVOptions {
17+
export interface DAVOptions {
1818
axiosClient: AxiosInstance
1919
baseUrl: string
2020
}
2121

22-
interface DavResult {
22+
export interface DavResult {
2323
body: WebDavResponseResource[] | undefined
2424
status: number
2525
result: Response

packages/web-client/tsconfig.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "@ownclouders/tsconfig"
3+
}

packages/web-client/vite.config.ts

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { join, resolve } from 'path'
2+
import { defineConfig, searchForWorkspaceRoot } from 'vite'
3+
import dts from 'vite-plugin-dts'
4+
5+
const projectRootDir = searchForWorkspaceRoot(process.cwd())
6+
7+
export default defineConfig({
8+
resolve: {
9+
alias: {
10+
path: 'rollup-plugin-node-polyfills/polyfills/path',
11+
crypto: join(projectRootDir, 'polyfills/crypto.js'),
12+
stream: 'rollup-plugin-node-polyfills/polyfills/stream',
13+
string_decoder: 'rollup-plugin-node-polyfills/polyfills/string-decoder',
14+
util: 'rollup-plugin-node-polyfills/polyfills/util',
15+
buffer: 'rollup-plugin-node-polyfills/polyfills/buffer-es6',
16+
process: 'rollup-plugin-node-polyfills/polyfills/process-es6',
17+
events: 'rollup-plugin-node-polyfills/polyfills/events'
18+
}
19+
},
20+
build: {
21+
lib: {
22+
entry: {
23+
'web-client': resolve(__dirname, 'src/index.ts'),
24+
'web-client/graph': resolve(__dirname, 'src/graph/index.ts'),
25+
'web-client/graph/generated': resolve(__dirname, 'src/graph/generated/index.ts'),
26+
'web-client/ocs': resolve(__dirname, 'src/ocs/index.ts'),
27+
'web-client/sse': resolve(__dirname, 'src/sse/index.ts'),
28+
'web-client/webdav': resolve(__dirname, 'src/webdav/index.ts')
29+
}
30+
}
31+
},
32+
plugins: [dts()]
33+
})

0 commit comments

Comments
 (0)